Python
Programming
Lesson 4 - Variables
Task 1 - Film Prices
You need to create a program that works out the total cost of people going to watch a film at the cinema. They will enter the film they want to watch and the number of adults and children. Adults cost £5 and children £3. Follow the steps below to make the program.
Use the success criteria below to help you:
Use input to ask the user to “Enter the film you want to see” and store it in a variable called film
Use input to ask the user to “Enter the number of adults” and store it in a variable called adults
Use input to ask the user to “Enter the number of children” and store it in a variable called children
Calculation to work out the adult ticket total (5 * adults) and store it in a variable called adulttotal
Calculation to work out the child ticket total (3 * children) and store it in a variable called childtotal
Calculation to work out the grand total (childtotal + adulttotal)
A print message that says the film they have chosen and how much it costs for the number of adults and children to see the film, an example is shown above.
Extension 1
Improve the program so that it displays the total cost with the correct formatting e.g. £19.00
Use the guidance below to help you do this:
To format a variable as currency in a print message you need to add the following code:
Before
After
Extension 2
Improve your print message so it says the cost for the adults and the cost for the children, an example is given below.
Task 2 - Circle Program
You need to create a program that works out the area and circumference of a circle. The user will input the radius and then the area and circumference calculated.
Area Calculation: πr2
Circumference Calculation: 2πr
For this task π, = 3.14159
The program should then output the radius, the area and the circumference. The area and circumference should be rounded to two decimal places.
HINTS:
Get the user input stored first
Store the value of pie
Create both calculations and store them in separate variables
Output the information in a message box
Evidence point
Open the Assignment in Google Classroom called Student Evidence - L4 - Variables.
Take a screenshot of your code for:
Task 1 - Film Prices
Task 2 - Circle Program
For each program click on Share and choose Link. Copy the link and paste it into the document, this means you can come back to it in future lessons.