0
Divisible case #3
numero = int(input()) numDiv = input() if " " in numDiv: numDiv = numDiv.replace(" ", "") for i in numDiv: if int(i) == 0: resultado = "not divisible by all" break div = numero%int(i) if div != 0: resultado = "not divisible by all" break else: resultado = "divisible by all" print (resultado) What would be needed in the code, since case 3 always gives an error.
1 Réponse
+ 5
Use
numDiv = [int(v) for v in numDiv.split(' ')]
instead of
if " " in numDiv:
numDiv = numDiv.replace(" ", "")