6.5 While Loop Flashcards
1
Q
What does While loop do?
A
It repeatedly executes the instructions inside the loop while a certain condition remains valid
2
Q
What is the structure for a While statement?
A
While condition is true: do A
3
Q
Write a syntax for a while loop
A
counter = 5
while counter>0:
print (“Counter=”, counter)
counter=counter-1