Python - Section 6 Practice Tasks

Task One

Using for loops, create a program to output this nursery rhyme: "1, 2, 3, 4, 5, Once I caught a fish alive, 6, 7, 8, 9, 10 then I let it go again".

 

Requirements for full marks:

  • A comment at the start to explain what a for loop is.

  • Two for loops.

Example solution:

Task Two

Create a program using a while loop that keeps asking a user to enter a number and adds those numbers together to a total. 

 

When the total goes over 100 the program stops and outputs: “OVERLOAD! You have gone over 100!”

Requirements for full marks:

  • A comment at the start to explain what a while loop is.

Example solution:

© CSNewbs 2019