In Python, is there a way to test if a number is divisible by multiple numbers without writing out the modulo operation for each factor?
More specifically, is there a better way to write this code instead of typing i % n == 0 ninety times?
if i % 11 == 0 and i % 12 == 0 and i % 13 == 0 ... and i % 100 == 0:
print(i)
Thanks!
Use
all()and a Generator Expression: