Section 7 Practice Tasks

Practice Tasks for Subroutines

1. Create a program that asks a user their name, age and favourite colour. Put each of these questions in a different subroutine. (Remember to call each subroutine in order)

2. Create a program that asks a user to input the length of a side in a square. Write a function that takes this value and outputs the area of the square.

3. Create a program that takes 3 inputs from the user – a name, a creature and a place. Write a function that outputs a story using the user’s answers.

It might look a bit like this:

pnewbs


< Back to Section Seven