# Ride height

Are you tall enough for a ride at an amusement park?

## Try

Select the button below to open the Python program in a new window. Run the program and read the lines of code to see if you can understand how it works. It will be helpful to arrange your display so that you can have this browser window on one side of the screen and the code on the other.

Watch this video to learn about the new concepts shown in the program:

## Investigate

Identify a condition in the program.

`height > 104` is known as a condition. The outcome of a condition is either True or False.

State the two essential parts of the `if` selection statement and two optional parts.

Two essential parts of the `if` command:

1. A condition followed by a colon
2. Indented commands to execute if the condition is true.

Two optional parts:

1. An `else:`
2. Indented commands to execute if the condition is false.

## Make

### Success Criteria

Change the program so that it works for a toddler’s merry-go-round:

1. The child cannot be over 91cm to go on the ride.

#### Typical inputs and outputs from the program would be:

Enter the height of the person in cm: 110

Sorry, you are too tall.

Enter the height of the person in cm: 78

Height OK.

#### Knowledge Organiser

Use these resources to learn about new commands for this level and to help you meet the success criteria.

###### Notes:

If commands are used to branch a program in one of two directions.

if x < y:

If the value of x is less than the value of y do the commands indented underneath this command.

if x > y:

If the value of x is greater than the value of y do the commands indented underneath this command.

else:

If the condition is not met do the commands indented underneath this command instead.

Code must be indented inside if and else statements. Only one part of the code will be run, the other part will be ignored.

## Evaluate

Run the unit tests below to check that your program has met the success criteria.

Enter the height of the person in cm: 150

Sorry, you are too tall.

Enter the height of the person in cm: 83

Height OK.

Enter the height of the person in cm: 91

Height OK.

Enter the height of the person in cm: 92

Sorry, you are too tall.

Craig ‘n’ Dave

In partnership with