0% found this document useful (0 votes)
305 views

Python Skills Worksheet 2a

This document contains a worksheet on selection (if/else statements) in Python. It includes examples of correct and incorrect if statements and tasks students to write programs comparing two numbers, making music recommendations based on genre, and creating a 5 question multiple choice quiz with feedback on their score.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
305 views

Python Skills Worksheet 2a

This document contains a worksheet on selection (if/else statements) in Python. It includes examples of correct and incorrect if statements and tasks students to write programs comparing two numbers, making music recommendations based on genre, and creating a 5 question multiple choice quiz with feedback on their score.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Worksheet 2a

Practical programming skills in Python

Worksheet 2a Selection
1. Mark each program as being correct, or incorrect. If incorrect, state the correct operator.

Correct
Program Correct?
Operator
if price < 1000:
Incorrect >
print(“Too expensive”)

if password == correctPassword:
print(“Error, incorrect password”)

if score >= 60:


print(“Test passed”)

if guess < target:


print(“Guess lower!”)

if balance > 100:


print(“Balance of £100 or more confirmed”)

if lives <= 0:
print(“Game over”)

2. Write a program that will ask for two numbers. Use a series of if statements to display
whether the two numbers are the same or different, and if relevant, which one is larger.

1
Worksheet 2a
Practical programming skills in Python

3. Write a program that will ask for a favourite genre (type) of music, and then make a
recommendation. For example, if they like rock then they should list to the Kaiser Chiefs, or
if they like R&B they should listen to Rihanna.

4. Write a multiple choice quiz on a topic of your choosing. There should be 5 questions and
each question should have 3 possible answers. Use if statements to tell the user if they
were correct and to keep a running total of their score. At the end of the quiz, display a
suitable message to the user – either “You’re a genius”, “Not bad”, or “Must try harder”
depending on the user’s score.

You might also like