Repeating loops | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Repeating loops

Can someone show me how to make a loop that goes about 50 times please? Thanks

20th Feb 2017, 10:11 PM
Windy J
Windy J - avatar
3 Answers
+ 1
for i in range(50): print(i) OR run=0 while run <50: print(run) run=run+1
20th Feb 2017, 10:16 PM
LordHill
LordHill - avatar
+ 1
This code prints a list of numbers 0-49 run=0 while run <50: print(run) run+=1 (Note: 50 is not included if you need change >=50 in code) This code prints out "run" 50 times run=0 while run <50: print("run") run+=1 Highlight: run = run +1 <===> run+=1
21st Feb 2017, 4:52 PM
Wbtist
Wbtist - avatar
+ 1
thanks for the help guys!! Its really helpful. ^-^
22nd Feb 2017, 6:34 PM
Windy J
Windy J - avatar