can someone explain while loop in python and an example for while loop?
Answers
Answered by
1
while loop statement in Python programming language repeatedly executes a target statement as long as a given condition is true.
for example:
count = 0
while (count < 9):
print 'The count is:', count
count = count + 1
print "Good bye!"
output of the programme should be:
The count is: 0
The count is: 1
The count is: 2
The count is: 3
The count is: 4
The count is: 5
The count is: 6
The count is: 7
The count is: 8
Good bye!
Similar questions