PythonByteSize
  • Home
  • Video Index
    • 1. The Basics
    • 2. Python Program Structures
    • 3. Python Operators
    • 4. Python Functions
    • 5. Introduction to Classes and Objects
    • 6. Python Strings
    • 7. User Defined Functions
    • 8. Classes and Objects
    • 9. Python Dictionaries
    • 10. Python tkinter
    • 11. Python Lists
    • 12. Python Namespaces
    • 13. Turtle Graphics
    • 14. Python Tips
    • 15. Complex Numbers
  • 1-Minute Videos
  • Exercise Index
    • 1. The Basics Exercises
    • 2. Python Program Structures Exercises
    • 3. Python Operators Exercises
    • 4. Python Functions Exercises
  • Donate
  • Computing Topics
  • Mathematics
  • Educators
  • Contact
  • About

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 >>

Please consider donating to help with the costs incurred in developing this website.             Donate >>