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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the structure for a While statement?

A

While condition is true: do A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Write a syntax for a while loop

A

counter = 5
while counter>0:
print (“Counter=”, counter)
counter=counter-1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly