How do you know how many numbers will be displayed whe using while loops | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do you know how many numbers will be displayed whe using while loops

4th Nov 2017, 5:21 PM
Festus Mabale
Festus Mabale - avatar
8 Answers
+ 1
It will run as many times until the statement is false or unless you use break. eg 1. while True: //without break statement will be infinite while x < y: //will run as long as y is greater than x i hope this answers your question
4th Nov 2017, 7:26 PM
Kyle Kibet
Kyle Kibet - avatar
+ 3
@Zeke Williams You beat me to it. But the syntax for print statements in Python 3 is: print(arguments)
4th Nov 2017, 5:45 PM
LunarCoffee
LunarCoffee - avatar
+ 1
you dont, thats what for loops are for
4th Nov 2017, 5:22 PM
Jeremy
Jeremy - avatar
0
the question is asking for while loops not for loops
4th Nov 2017, 5:34 PM
Festus Mabale
Festus Mabale - avatar
0
which i answered...
4th Nov 2017, 5:35 PM
Jeremy
Jeremy - avatar
0
You know by looking at the conditional in the while loop. I can't quite remember the syntax for python, but the condition comes right after while: while condition: statements count = 0 while count < 5: print count count = count + 1 You know this will display 5 numbers, 0, 1, 2, 3, and 4
4th Nov 2017, 5:41 PM
Zeke Williams
Zeke Williams - avatar
0
ok this is what am talking about how many many numbers does this code print i=3 while i>=o: print(i) i=i-1
4th Nov 2017, 5:45 PM
Festus Mabale
Festus Mabale - avatar
0
4. Count it
4th Nov 2017, 7:21 PM
Zeke Williams
Zeke Williams - avatar