Python
Programming
Lesson 6 - Selection
Task 1 - SNAP
You need to create a program that allows the user to enter three numbers. The program will then need to check to see if all three numbers are the same and say SNAP if they are. An example of how it should work is shown to the right.
Use the success criteria below to help you:
Use input to ask the user to “Enter the first number” and store it in a variable called number1
Use input to ask the user to “Enter the second number” and store it in a variable called number2
Use input to ask the user to “Enter the third number” and store it in a variable called number3
A IF statement that checks to see if all three numbers are the same.
If they are a print message should display saying SNAP
If they aren’t a print message should display saying “All three numbers aren’t the same”
HINT: You will need to use and when creating the IF to check more than one condition.
Extension
Develop your program so that if all three numbers aren’t the same it checks to see if two numbers are the same, and then says two numbers are the same.
Extension 2
Improve your program further so that if 2 numbers are the same it says which two numbers are the same.
HINT: You will need to add another IF inside the IF that checks if two numbers are the same to work out which two.
Task 2 - Triangle or Square Area
You need to create a program that allows the user enter the length of one side of a shape, they should then enter whether the shape is a triangle or square. The program will then need to check to see which shape they have selected and work out the area.
NOTE: For this program assume all three sides on the triangle are the same length.
The calculation for the area of a triangle or square is:
triangle = (length * length) / 2
square = length * length
Evidence point
Open the Assignment in Google Classroom called Student Evidence - L6 - Selection.
Take a screenshot of your code for:
Task 1 - SNAP
Task 2 - Triangle or Square Area
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.