Section 6 Practice Tasks

Practice Tasks for 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.
  • Two print lines.

    Practice Tasks for While Loops

    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: “You have gone over 100!”

    Requirements for full marks:

    • A comment at the start to explain what a while loop is.
    • Create a variable for the amount of numbers that the user has entered. Display this amount when they go over 100.

      < Back to Section Six