Python - Section 2 Practice Tasks
Task One: Food & Colour
Ask a user to input their favourite colour and their favourite food and then print a response using both answers.
​
Requirements for a complete program:​
-
Use only one print line. Include both of the user's answers in the print line.
-
Include capital letters, full stops and no irregular spacing in the printed line.
​
Remember: Break up variables in a print line by using commas or plus signs between each part of the "sentence".
Example solutions:
What is your favourite colour? green
What is your favourite food? cheese
Yum! I'll have green cheese for dinner tonight!
What is your favourite colour? purple
What is your favourite food? ice cream
Let's have purple ice cream for breakfast!
Task Two: Trivia Question
Create a program that asks the user to input an answer to a trivia question of your choice then prints the correct answer with their response too.
Requirements for a complete program:
-
Only two lines.
-
Include capital letters, full stops and no irregular spacing in the printed line.
Example solution:
What is the capital city of Botswana? Windhoek
Correct answer: Gaborone. Your answer: Windhoek
What is the closest planet to Earth? Mars
Correct answer: Mars. Your answer: Mars
Task Three: Getting to School
Create a program that asks the user how they get to school and how many minutes it takes them (using int).
​
Then print an appropriate response that uses both variables.
​
Requirements for a complete program:​​
-
Use only one print line. Include both of the user's answers in the print line.
-
Include capital letters, full stops and no irregular spacing in the printed line.
Example solution:
How do you get to school? car
How many minutes does it take you? 45
Really? It takes you 45 minutes to get here by car?
How do you get to school? walking
How many minutes does it take you? 20
Really? It takes you 20 minutes to get here by walking?