Exercise 3.4. (The for loop iteration)
1. Ensure you have viewed the video (associated with this exercise) at this link >>
2. It is standard practice to have how many spaces when indenting a program statement within a for … loop?
3. The first line of a for ... loop should always end with what punctuation mark?
4. What is displayed on the Visual Display Unit by the program below (Exercise 3.4. Example 1). You can check your own answer by copying the code, pasting it into your Python editor and executing it.
Exercise 3.4. Example 1
5. Amend the program above (Exercise 3.4. Example 1).so that is uses the range function instead of in (0,1,2,3). The amended program should display exactly the same output as the program above (Exercise 3.4. Example 1).
6. What is displayed on the Visual Display Unit by the program below (Exercise 3.4. Example 2). You can check your own answer by copying the code, pasting it into your Python editor and executing it.
Exercise 3.4. Example 2
7. With respect to the program below (Exercise 3.4 Example 3) how many program statements are within the for ... loop?
Exercise 3.4. Example 3
8. With respect to the program above (Exercise 3.4 Example 3) which program statements are outside of the loop?
9. What is displayed on the Visual Display Unit for the program above (Exercise 3.4 Example 3)? You can check your own answer by copying the code, pasting it into your Python editor and executing it.
10. What is displayed on the Visual Display Unit for each the programs below (Exercise 3.4 Example 4 through to Example 6)? You can check your own answer by copying the code, pasting it into your Python editor and executing it.
Exercise 3.4. Example 4
Exercise 3.4. Example 5
Exercise 3.4. Example 6
END Next Exercise >>