TutorSyntax · Learn. Practise. Build.

Python First Steps · Hints & Solutions

Six original final challenges from Python Programming: First Steps. Reveal just enough to get unstuck, then test your own program before comparing with a worked answer.

Try first: The printed book already includes model guidance in its answer section. The code below adds complete example programs for Challenges A–F. Different correct programs are possible. Hints and worked solutions are hidden until you choose to reveal them.
CHALLENGE A · Level 1 · Make it work

Personal welcome card

Ask for first name and favourite hobby, then produce three output lines containing both answers.

Core skills: Variables, input and print

1 · Reveal a small hint

Save the answers from two input() calls in separate variables. You need three print() statements.

2 · Show the algorithm steps
  1. Ask for the first name and store it.
  2. Ask for the favourite hobby and store it.
  3. Print three lines; use the variables on at least two lines.
3 · Reveal a complete worked solution

This is one possible solution. Compare inputs, processing and outputs with your own code.

# Challenge A — Personal welcome card
# One valid answer; different messages are fine.
name = input("What is your first name? ")
hobby = input("What is your favourite hobby? ")

print("Welcome", name)
print("Your favourite hobby is", hobby)
print("Enjoy practising Python!")
Test your program: Enter two different names. Exactly three print() statements should produce three lines after the two input prompts.

Stretch: Add the learner’s favourite colour and incorporate it in one of the three output lines.

CHALLENGE B · Level 1 · Make it work

Pocket-money planner

Ask for weekly allowance and purchase price. Display the balance rounded to two decimal places.

Core skills: Numbers, conversion and arithmetic

1 · Reveal a small hint

input() gives text. Convert each input using float(), subtract the cost, then use round(..., 2).

2 · Show the algorithm steps
  1. Ask for the allowance and purchase cost as floats.
  2. Subtract the cost from the allowance.
  3. Round the difference to two decimal places and print it.
3 · Reveal a complete worked solution

This is one possible solution. Compare inputs, processing and outputs with your own code.

# Challenge B — Pocket-money planner
allowance = float(input("Weekly allowance (£): "))
cost = float(input("Planned purchase (£): "))

remaining = allowance - cost
print("Money left: £", round(remaining, 2))
# A negative answer means the purchase exceeds the allowance.
Test your program: £10 and £3.50 should leave 6.5 (or 6.50); £5 and £7 should give -2.0. A negative result means overspending.

Stretch: Add a conditional message saying whether the purchase is affordable; treat exactly £0 remaining as affordable.

CHALLENGE C · Level 2 · Decide and repeat

Ticket price checker

Ask for customer age. Under 13 costs £4, and everyone else pays £7.

Core skills: Selection and comparison

1 · Reveal a small hint

Convert age with int(). Use age < 13, not age <= 13.

2 · Show the algorithm steps
  1. Convert the age input to an integer.
  2. If age is below 13, choose the £4 ticket.
  3. Otherwise show the £7 ticket price.
3 · Reveal a complete worked solution

This is one possible solution. Compare inputs, processing and outputs with your own code.

# Challenge C — Ticket price checker
age = int(input("Customer age: "))

if age < 13:
    print("Ticket price: £4")
else:
    print("Ticket price: £7")
Test your program: At age 12 the ticket costs £4; at age 13 it costs £7. These values test the boundary.

Stretch: Check for a negative age before applying the pricing rules and explain why input validation matters.

CHALLENGE D · Level 2 · Decide and repeat

Multiples trainer

Ask for a whole number and display its first five positive multiples using a for loop.

Core skills: For loops and multiplication

1 · Reveal a small hint

Try range(1, 6), which produces the numbers 1 to 5. Multiply your input by each number.

2 · Show the algorithm steps
  1. Convert the input to an integer.
  2. Loop through 1, 2, 3, 4 and 5.
  3. Multiply the input by the loop counter and print the result.
3 · Reveal a complete worked solution

This is one possible solution. Compare inputs, processing and outputs with your own code.

# Challenge D — Multiples trainer
number = int(input("Choose a whole number: "))

for multiple in range(1, 6):
    print(number * multiple)
Test your program: Input 3 should print 3, 6, 9, 12 and 15, in that order.

Stretch: As suggested in the book, use a while loop to accept new numbers until the learner types “stop”.

CHALLENGE E · Level 3 · Build independently

Random revision picker

Store at least five subjects in a list and use random.choice() to recommend one.

Core skills: Lists and random.choice()

1 · Reveal a small hint

Use import random, create a list of five or more subject strings, and pass the list to random.choice().

2 · Show the algorithm steps
  1. Import the random module.
  2. Define a list containing at least five subjects.
  3. Choose and print one member of the list. Rerun to observe different choices.
3 · Reveal a complete worked solution

This is one possible solution. Compare inputs, processing and outputs with your own code.

# Challenge E — Random revision picker
import random

subjects = ["Maths", "English", "Science", "History", "Computing"]
suggestion = random.choice(subjects)
print("Revise this subject today:", suggestion)
# Rerun the program to get another random suggestion.
Test your program: Every suggestion must be in the original subjects list. Run the program several times; a repeat is possible and is not an error.

Stretch: Ask whether the learner would like another suggestion, repeating until they say no.

CHALLENGE F · Level 3 · Build independently

Simple quiz scoreboard

Store five quiz scores. Count scores of 5 or higher, then display the number of passes and scores checked.

Core skills: Lists, loops, counters and if

1 · Reveal a small hint

Start passes at zero. Loop through the list, and only increment when score >= 5.

2 · Show the algorithm steps
  1. Make a list with five quiz scores and set passes to 0.
  2. Visit each score in a for loop and add one when it is at least 5.
  3. Display passes and len(scores) to show the total checked.
3 · Reveal a complete worked solution

This is one possible solution. Compare inputs, processing and outputs with your own code.

# Challenge F — Simple quiz scoreboard
scores = [4, 7, 9, 2, 6]
passes = 0

for score in scores:
    if score >= 5:
        passes = passes + 1

print("Passing scores:", passes)
print("Scores checked:", len(scores))
Test your program: For [4, 7, 9, 2, 6], the program should report 3 passes out of 5 scores.

Stretch: Calculate the percentage passed, and explain why the pass threshold must be clearly documented.

Download all six worked Python files

Open the ZIP only after attempting the tasks. These commented Python 3 examples use the standard library and are kept separate from the six blank starters.