Skip to content
CodEnfant
FR EN
Contact us
Menu

Home / Blog

THE CODENFANT GUIDE

Python for 14-Year-Olds: A First Quiz and a Path Towards AI

A 14-year-old can start learning Python without previous coding experience. A useful first goal is a small program they can read, change and explain. A two-question quiz introduces several core ideas: storing information, repeating an action, comparing answers and updating a score.

This guide includes an original starter exercise and practical signs of progress. For individual support, explore our live Python and AI classes for teens aged 14+.

What does a beginner need first?

For this exercise, use a computer with Python 3 set up with help from an adult or instructor. The student needs to save a file, find it again and run it. They do not need to understand functions, advanced equations or machine learning before beginning.

Scratch experience can make loops and conditions feel familiar, but it is not a requirement. Our guide to moving from Scratch to Python can help families discuss that transition.

Build a first Python quiz with a score

Create a file called quiz.py, enter this example in the editor and run it with Python 3. Answer each question in the console and press Enter.

questions = [
    ("What is 2 + 2?", "4"),
    ("Which Python loop iterates over a list?", "for")
]

score = 0

for question, expected_answer in questions:
    answer = input(question + " ").strip().lower()
    if answer == expected_answer:
        score += 1
        print("Correct!")
    else:
        print("The expected answer is:", expected_answer)

print(f"Score: {score}/{len(questions)}")

The expected answers are 4 and for. Answering both correctly produces Score: 2/2. For the first run, follow what happens. Then change one thing and predict the effect before running it again.

Four ideas the student should be able to explain

  • The questions list stores pairs of questions and expected answers.
  • The score variable keeps a value that increases after a correct answer.
  • The for loop visits each pair in the list.
  • The if condition decides which message to show and whether to increase the score.

strip() removes spaces at the beginning and end of an answer, while lower() changes letters to lowercase. That accepts an answer such as FOR. This version still compares text: it does not recognise “four” as equivalent to “4”.

Improve the quiz one step at a time

Add a third question first. Ask the student to predict the highest possible score, then try three cases: every answer correct, every answer incorrect and a mixture. A successful change should work in each case.

Next, they could show a different final message depending on the score. Later, they can move part of the program into a function or save results in a file. Introducing all those changes together makes it harder to discover which change caused a problem.

How can a parent recognise real progress?

Ask your teen to demonstrate a change they chose, explain why the score increases and find a small mistake. They do not need to recite definitions. Being able to predict the program’s behaviour and check that prediction is a useful sign that the ideas are becoming familiar.

If a change breaks the program, return to the last working version. Read the error message and examine the relevant line together. An appropriate class should make room for questions and debugging as well as new features.

When should a teen move from Python to AI?

Before a first machine learning project, the student should be comfortable with collections, functions and reading files. A useful intermediate step is opening a small table of data and explaining a chart made from it.

The move towards AI should follow those skills rather than a fixed deadline. Our guide to machine learning projects for teens explains what comes next. For more foundation practice, explore these Python project ideas for beginners.

Find the right Python class for your teen

CodEnfant’s Python and AI classes for teens aged 14+ are live, one-to-one online lessons. The path covers Python foundations, games and applications, then data and AI when the student is ready. Progress depends on understanding and practice.

Parent questions

Does my teen need advanced maths?

This quiz mainly involves following steps, comparing answers and counting. Further mathematical ideas can be introduced when a project needs them.

Can they use an AI coding assistant?

An assistant may help explain an idea. The student should still read the code, run suitable checks and explain their changes. A copied result alone does not show which concepts are secure.

Further reading: the official Python guide to conditions, loops and functions.

Which learning path fits your child?

Age, experience and interests help us choose a suitable starting point.

Compare programs →