Apr-16-2020, 08:52 PM
# find the first number that is divided by 1 to 9 with 0 remainder for i in range (10000): x = i % 3 y = i % 4 z = i % 7 a = i % 5 b = i % 6 c = i % 8 d = i % 9 if x==y==z==a==b==c==d==0: print (i)As it mention, i wanted to find numbers which are divided by 1 to 9 numbers with 0 remainders.
I tried to make it dynamic like instead of 1 to 9 what if i search numbers which are divided by 1 to 20 numbers.
I have already repeated lots of code line for 1 to 9 numbers and i don't want to do that for more numbers.
I tried to make a list of 1 to 20 numbers and with loop tried to iterate but failed.
Thanks in advance.
Professional Dentist(32years) fell in love with Python during COVID-19 Lockdown.
"Nothing can stop you from learning new things except your own will"
"Nothing can stop you from learning new things except your own will"