Python loop | SoloLearn: Learn to code for FREE!

+6

Python loop

I need to print the number divisible by 17 starting from 200. How to do that with the while loop? No while loop version of mine: a=200 b=300 #or any other number supposedly more than 17 for i in range(a, b): if i%17 == 0: print(i) break;

9/14/2020 11:52:04 AM

JSiegerheim

26 Answers

New Answer

+2

a=200 while a: if a%17==0: print(a) break else: a+=1

+10

a=200 b=300 while a<=300: if a%17==0: print(a) a+=1

+3

greaaaaaaaat! it worked

+3

vijay-busy a=200 while a: if a%17==0: print(a) break else: a+=1 😀 🍻 a-=1; IMHO 🙄

+2

Z = 200+ 17-200%17 as loop z=200 while z%17: z+=1 print(z)

+2

a=200 b=300 while a<=300: if a%17==0: print(a) a+=1

+2

a=200 while a <= 300: if a%17==0: print(a) break else: a+=1

+2

Hello a=200 while a>0: if a%17==0: print (a) break

+2

That's great answer ✅

+1

is it possible to do that without b or the range, meaning from 200 to infinity, as 300 an option that occured to me

+1

300 is not in the statement

+1

ok! I think I did! All this stuff is new to me) sorry for ignorance

+1

n=600 if a in range(1,n): print(a)

+1

x = 200 while (True): if x%17 == 0: break else: x=x+1

+1

x = 200 l = [ ] while True: if x%17 == 0: l.append(x) else: x+=1

+1

JSiegerheim a, b=200, 300 while a<b: if not a%17: print(a) break a+=1

0

a=200 while a: if a%17==0: print(a) a+=1

0

200 to infinity

0

Here a=200 Which means a variable greater than or equal to 1 is true

0

maybe my question is not clear enough! the output must be 204 as it is the least number after 200 divisible by 17. i just don’t know how to write the function using while loop. thanks!