Week 9 subject 1: Nested loops
- For loop inside a for loop
- Different loop variables used
- Note how many times the contents of the loop are executed
- Use input() to get a line of input
- Provide prompt as argument to input()
- Convert the return value of input() with int() or float()
- while loops can be used to get repeated user input
- Common while loops format:
- Initial input() before entering the loops
- additional input() as the final step inside the loop
No comments:
Post a Comment