1. The pseudo code and flowchart show the use of a while loop. Can you fill in the blanks?
2. If a program needs some data from a user and they keep on typing invalid data, it makes sense to keep on asking them to enter the right stuff until they do. Can you fill in the blanks on line 5?
3. The following code uses an if statement within a while loop. The loop will only start and continue if ...
4. The difference between a repeat -until loop and a while loop is that the condition in a while loop is at the _____________. In a for loop however, both the ___________________ is pre-defined at the start.
5. The following program prints "You are rich" ....and keeps doing so! What do you need to change on line 7 to make it print "You are rich" only four times? See comments in code for a hint.
6. The following program will print 0 forever! We want to print the numbers: 0,1,2,3,4,5. What is missing on line 5?
7. What would you need to change on line 2 and 3 in order to print 1,2,3,4,5,6,7,8,9,10
8. In the following code a boolean flag (found=False) is used within a while loop. On line 4 if the user enters 'yes', what will happen next?
9. Analyse the program below. What needs to happen in order for line 14 to be executed?
10. In this loop, the while loop starts and goes on indefinitely until 'y' is pressed. What command is used to exit the loop?