Blog

Teaching Python, game-based learning, coding competitions and AI agents.

Send in your questions, suggestions and success stories

No account needed — good questions often become posts.

Python fundamentals walkthrough, from Hello World to a guessing game

The first exercise in the free Agent Games Python Fundamentals course takes one line to greet the world. By the twelfth, you can build a game that picks a secret number, gives the player hints and keeps score. The walkthrough takes about 69 minutes. If you’re coding along, pause at the start of each exercise and try it before watching the solution. Watch the introduction at 0:00

How do you get Python to greet someone by name?

Start by printing a greeting exactly as you want it to appear. In print("Hello, World!"), the quotation marks tell Python where the text begins and ends. The comma and exclamation mark inside them appear on screen. 3:20 · Hello, World!

Now imagine the greeting comes from a spaceship. Store the captain’s name in a variable, then use it in the welcome message. Change name = "Bob" to your own name and run it again. The same print statement now welcomes a different captain. 4:15 · Welcome Aboard

What if you only find out who’s at the keyboard after the program starts? With name = input("What is your name? "), Python pauses for a reply. Type a name and press Enter. The next line can use that reply to greet you. 6:37 · Hello, Human

Ask for an age as well, and you have two pieces of text to fit into a sentence. An f-string lets you write the sentence in reading order. In f"{name} is {age} years old.", Python fills each pair of braces with the current value of the variable inside. 8:46 · Name and Age

When does an answer need to become a number?

An age can go straight into a greeting as text. To work out how old someone will be next year, the program needs to do arithmetic. Try entering 12. The reply arrives as the string "12", and int(age) turns it into the integer you can add one to. The same conversion lets you work out last year’s age or look a decade ahead. 11:10 · Age in the Future

A reply can also determine which line runs next. In the greeting exercise, name == "Maya" asks a question with a true or false answer. An if checks the first name, each elif gives another name its own greeting, and the final else handles a stranger. Try both Maya and maya to see how precisely Python compares strings. 17:05 · Who Goes There?

The grade calculator uses the same branching structure with ranges of scores. A good way to test yours is to enter 89, 90, then 101. The first two should land on opposite sides of the B/A boundary. The third is outside the grading scale altogether. Those three runs tell you whether you’ve handled the edge of a grade and the edge of the scale. 21:45 · Grade Calculator

How do you transform text and repeat an action?

In Name Shout, the challenge is to make a name sound like someone calling across a room. Start with Mia. The string method .upper() gives you MIA, then doubling each vowel with .replace() gives you MIIAA. Each method returns a new string, so keep its result for the next change. 30:02 · Name Shout

Repeated Greetings starts with five hellos and then asks how many more you want. A for loop over range(5) runs its indented line five times. For the second loop, the user supplies the count. Try entering zero. You’ll still see the original five greetings, and the second loop will finish without printing another. 35:05 · Repeated Greetings

Return to the age calculation and try to break it. What should happen if someone types twelve? What about 121? Check the Age gives those replies different messages. It checks the text with .isdigit() before calling int(), then checks whether the resulting age exceeds 120. Only an accepted age reaches the decade calculation. 38:30 · Check the Age

What changes when a guessing game keeps score?

Seven Guesses ties input, comparisons and repetition together. Pick a secret number once with random.randint(1, 100), then give the player up to seven attempts. Keeping that line before the loop matters. If the target changed on every turn, the previous hint would tell the player nothing about the next guess. A correct guess ends the loop early with break. 51:03 · Seven Guesses

The last exercise changes one rule. The player starts with ten points, and each wrong numeric guess costs one. A typing mistake earns a prompt to try again and leaves the score alone. That means you can’t tell in advance how many times you’ll need to ask for input. The condition while not found and score > 0 expresses exactly when to ask again. 1:00:54 · Guess with a Score

Try one final experiment in your own copy. Set the secret to 50 for a round, then enter hello, 25 and 50. Can you predict the final score before you press Enter? It should be nine. If you get a different result, follow the score through each of those three turns. You now have a repeatable way to test a game that usually depends on luck. Try the free Python course

Comments are restricted to teachers only and moderated for child safety reasons.

Learning to code: AI is not your friend

If you are learning to code, asking AI to write your programs will make you a worse programmer. It gets you working code much faster, but it removes the loop of errors, searching and fixing that makes programming one of the easiest subjects to teach yourself. The better use of AI is as a hint-giver that sends you back into that loop, not one that skips it.

Who am I to say this?

The last time I made videos on my YouTube channel, three and a half years ago, I was a teacher. I spent ten years in computer science education. Since then I have been working as a software engineer, and I am now a mid-level engineer at an experience-design company, working mostly in Python and Django on the back end.

So learning to code alongside AI has been my life for the past three and a half years, and so has living with the changes AI is bringing to the industry. These conclusions come from that experience, and they have some basis in recent research.

Are developers really learning with AI now?

Yes, and quickly. The Stack Overflow developer survey asks, "In the past year, when you learned to code, what was your primary learning tool?" Over the last four surveys, AI has gone from 0% to 37% to 44% to 52.6%.

That still leaves a lot of people learning without AI. It turns out they are probably making a wise decision.

What does the research say?

Two recent studies are worth knowing about: one from Munich in Germany, and one run by Anthropic. Neither has a huge number of participants, so they are by no means conclusive, but they are definitely interesting.

The Anthropic study gave two groups of junior engineers a unit of work that required some learning. One group used AI and the other did not. The AI group finished faster, of course, but both groups spent a similar amount of time on the task before a quiz, and the group without AI scored better. They learned more.

The Munich study used three groups: one with an open-ended chatbot (essentially ChatGPT, not on any rails), one with a chatbot that only gives hints, and one with no AI. The learning results were broadly similar, with one interesting caveat: the group with the hint bot was the most motivated and enjoyed the process the most.

That caveat is what I am taking away from it, because I have been working on AI hints since 2023.

Why is programming so easy to learn on your own?

For years I ran computer science competitions, and again and again I met high school students who were better than university level. When I talked to colleagues in other subjects, that just doesn't happen in maths, English, biology or physics.

The reason is what I call the learning loop. Programming gives you a constant stream of meaningful, instant feedback:

  1. You have a goal, say a Python script that does something.
  2. You write some code and run it.
  3. It produces an error. Now you have something to search for: what does this mean? You read the docs, Stack Overflow, Google the message.
  4. You go back and make changes. Maybe you get another error, but it is a different error, so you are moving forward.
  5. Eventually it runs, and you are closer to your goal. Maybe the output isn't quite right, so you refine it, or refine the goal itself.

Compare that with an English essay, where you wait three, four or five days for the teacher to mark it before you get any feedback at all. Students in other subjects get far less feedback than developers do, which is why, once you start enjoying programming and doing a lot of it, you learn so fast.

I used to be a mechanical engineer, and the digital systems I work on today are a hundred times more complex than the mechanical systems I worked on then. I think that is the learning loop at work: it is so efficient that people learn to a higher level and can manage far more complexity.

What happens when AI enters the learning loop?

You have a goal. You ask AI to do it. You press run, and it just works. If you want to understand it, you ask AI and it gives you an explanation. None of the searching, the unpacking of errors, the reading of documentation needs to happen.

Picture the same goal tackled both ways. Without AI, you might take a hundred iterations: mostly errors at the start, refinements towards the end, and 80 or 90 trips to the docs, Google or Stack Overflow to understand something. With AI, you generate it once, refine it once, polish a couple of steps, and it's over.

That is much, much faster. But it is not a good learning loop.

  • With AI, you produce more code. You could argue about whether it is better code. It is certainly less human-readable, but it works, it is robust and it is fairly defensive.
  • Without AI, especially at the beginning, you produce less, but you learn more.

So if you are learning and leaning on Claude Code or Codex, it is making you worse at understanding code.

How can AI help instead?

This is what I am trying to build with Agent Games, the site I have been building since 2022. It started as a coding competition platform, and I have since generalised it so you can learn to code independently or use it in a classroom.

The core idea is the AI hint, and it puts you back into the learning loop. Say you are working on an exercise or writing an agent for one of the games: you are running a program with a goal, and you hit an error. Instead of a stack trace, which is very intimidating for beginners, you get a hint: "Look at line eight. And by the way, read this lesson." It points you straight to the right learning resource, you read it, and you are learning.

It reproduces the original learning loop, just more efficiently. Coding isn't really that difficult. It is that, compared with most subjects, it takes a lot more patience and perseverance at the very beginning. Hints should smooth out that start and speed it up a little.

What's next?

I have created high school level courses so far, and I will be making more on my YouTube channel. I already plan to cover some advanced Python I want to master myself: context managers, data classes and generators. I will put the content for them into Agent Games and go through the learning loop myself, so you can watch, and hopefully come along for the journey.

Links to the studies and resources are in the top comment on the video. And of course, I hope you check out Agent Games.

Comments are restricted to teachers only and moderated for child safety reasons.

Why Python?

I wrote the title of this article, and I had an outline of all the reasons I personally love Python. But when I sat down to write the article itself, I had a flashback to browsing the internet during the school holidays, looking for something innovative to pitch as a six-month elective. I thought about the types of questions teachers have when trying to choose learning domains that balance engagement, success, curriculum, allotted time and, most importantly, the cohort of students they will be teaching. And so, from that perspective, I asked myself: what are the questions teachers will be asking when deciding on a programming language?

  1. Is it easy enough for my students and me to learn?
  2. Are there lots of learning materials for this language?
  3. Can I do something really fun and engaging with this?
  4. When kids ask, "Why are we learning this?", will I have a good answer?

Now I am going to try to answer all of these.

1. Is it easy enough for my students and me to learn?

I have spent seven years teaching Python and about four running Python workshops and PD for teachers. My feeling was always that it was easy to have some success early, which tends to build momentum. However, the reality of most programming languages is that concepts build on one another. As soon as we progress to a moderate level of complexity, there are half a dozen concepts interacting, and any misconceptions that students may have compound quickly.

So, basically, teachers need to cover the basics again and again until mastery is reached. This is why Agent Games' flagship course, Python Fundamentals, practises most concepts again and again: 17 of its 19 core concepts appear in at least three exercises, and a core concept appears in about 11 exercises on average (see the concept map).

2. Are there lots of learning materials for this language?

OMG, yes! Type "learn Python" into Google, and you will be spoilt for choice. As a teacher, my main stop was W3Schools. However, with the advent of AI, as an experienced Python programmer, I can tell you that the latest Claude 5.5 and ChatGPT 6 models are all really good at it. When requested, they can explain concepts at a high-school level.

In Australia, teachers have free access to Grok Academy, which offers courses written primarily in Python. It's worth mentioning that I used to teach with Grok and worked there for 18 months. Given this abundance, I have designed Agent Games to copy what works for 70% of the content (exercises and interactive lessons). I turned the last 30% into more open-ended, high-ceiling, fun games where each student can proceed according to their ability.

3. Can I do something really fun and engaging with this?

Let me list some fun things that I did in the classroom using Python:

  • micro:bit drones that students built from a kit and programmed to fly using Python.
  • Recommendation engines where students built programs that quizzed an audience about movies or video games and produced recommendations.
  • 2D games with Pygame, like Space Invaders, Snake and platformers.
  • 3D games with the Ursina Game Engine.
  • Cybersecurity challenges like codebreaking and demonstrating how passwords can be hacked and why we need longer, more complex passwords.
  • Maths games: one of my very first Python programs in the classroom was called Probability Pokémon, created during the Pokémon Go craze. Pokémon appeared on a grid based on equations that involved probability, and kids set traps for them.
  • Finally, Agent Games, the platform you are on, is written in Python, which does the heavy lifting on the back end, with React.js on the front end.

4. When kids ask, "Why are we learning this?", will I have a good answer?

Oh yes, absolutely!

First of all, the chart below, from the GitHub Developer Survey, shows you what programmers are building the world's software with. And the answer is predominantly JavaScript and Python, with the role of JavaScript being to make things look pretty in the browser and Python doing pretty much everything else!

A line chart showing combined JavaScript and TypeScript usage ahead of Python, Java and C# from 2023 to 2025

Sourced from the GitHub Developer Survey.

But it's not just programmers. If you go to PyCon, you will find that programmers are about half the audience, with the other half being made up of scientists and educators. As science advances, it becomes more and more about data analysis, and most tools for this are built in Python. The same case can be made for finance, but that is a more secretive industry, which does not share as much as the ones I mentioned.

Comments are restricted to teachers only and moderated for child safety reasons.

AI in computer science education

In this post, I will argue two points about AI and their implications for teaching:

  • Unmanaged use of AI destroys students' incentive to learn.
  • AI dramatically raises the ceiling for student outcomes in computer science.

And if studies are your thing (I take them all with a grain of salt), I will cite two that illustrate these points.

Unmanaged use of AI destroys the incentive to learn

At the start of the year, Anthropic ran a study with 52 mostly junior software engineers to analyse how AI affects performance and learning. The participants were divided into two groups: one had access to AI to complete a task, and the other had none. To no one's surprise, the group with AI access completed the task faster, while the group without AI performed better on a quiz testing knowledge of the task.

Charts from Anthropic's study: the AI group finished slightly faster but scored lower on the knowledge quiz, and the ways participants used AI ranged from high-skill-development interactions such as generation-then-comprehension to low ones such as AI delegation

How AI assistance impacts coding speed and skill formation. Source: Anthropic.

This is not a surprise to anyone. As a software engineer, I live this reality daily. When I am under a time crunch, AI generates the code and I spend my time making sure nothing breaks instead of investing time to understand it. The one thing that reliably gets me to learn is working on projects with pedantic project owners who want to understand every design decision in the code review. Ultimately, this brings me to students, classrooms and my next point.

AI dramatically raises the ceiling for student outcomes in computer science

A study from the Technical University of Munich, published in Computers and Education: Artificial Intelligence, ran a similar comparison with 275 introductory programming students across three conditions: an AI tutor that gave hints but withheld full solutions, unrestricted ChatGPT, and no AI. Both AI groups scored far higher on the programming exercise itself (about 72% for ChatGPT and 58% for the tutor, versus 30% for the no-AI group), but this didn't translate into better understanding. The hint-based tutor edged out the other groups in conceptual understanding and, interestingly, increased students' intrinsic motivation, while students rated ChatGPT as easier and more helpful despite it offering no learning advantage.

I am proud to say that I have been working on code hints since December 2023. These hints are embedded in Agent Games, the coding education platform I am working on, with the idea that students receive an AI-generated hint only when they are truly stuck. There is no hint button, so students can't come to rely on it; a hint just shows up occasionally.

However, it's more than just hints. Programmers have the advantage of continuous feedback every time their code runs, and the only limitation for beginners is stack traces, which can look terrifying. This is where AI can help as well.

Honestly, I don't know whether, if I were teaching today, my students would do as well as they did in my final year of teaching (2022), before AI became a thing. However, I am confident that getting AI to work for our students, and not against them, is something we can figure out in the next couple of years.

Classroom implications

One big idea: create good incentives.

  • The code no longer matters. The only thing that needs to be rewarded is demonstrated understanding of the code. If you are a teacher, just assume the code is AI-generated; the same goes if you are a code reviewer.
  • Treat AI-generated code as a liability. If you submit something you don't understand, you lose a lot of marks. It's just like my job: I have a strong incentive to fire up the debugger and the Django shell to get to the bottom of how my code works, because I know a grilling is coming in the code review. The Agent Games platform flags all code that is pasted, or that shows a massive increase in complexity between submissions.
  • Type code in manually. Yep, typing in code forces you to slow down and think about what you are doing. I strongly recommend it.
  • Fail students for turning in AI work. I am not sure there is another way to send a clear message that the only way to pass, or to get good grades, is to genuinely understand the subject.

Comments are restricted to teachers only and moderated for child safety reasons.

A concept map for teaching Python

The Python Fundamentals concept map, with the Dictionaries concept selected and its lessons, exercises and curriculum links shown in a side panel

Select Dictionaries to see its lesson, suggested prerequisites, practice exercises, common mistakes and Australian Curriculum connections. The timeline shows where concepts appear and reappear through the course.

Here is the concept map for Python Fundamentals, the flagship course for Agent Games. It brings together 19 core concepts, the lessons that explain them, the exercises that practise them and their Australian Curriculum connections. It started as a nice visual that explains what it takes to learn the basics of Python, and it evolved into a building block that enables better assessment.

How it came about

In July 2026, when I completed the first version of Agent Games for the classroom (it used to be a coding competition platform), I started to think about content. The obvious choice was Python Fundamentals, the most popular course I have written, with over 10,000 students on Udemy and dozens of schools using it. I was using AI to help translate the transcripts and exercises into Agent Games activities, but I had a problem: eight sections and 49 lectures just looked like a big blob of content (or a book index) when pasted on a web page.

The Python Fundamentals course on Udemy: 8 sections, 49 lectures and 6 hours 16 minutes of content

The original Python Fundamentals course on Udemy: eight sections and 49 lectures.

I was hoping for something visual that gave teachers and students a clear idea of what they would be learning. I got my inspiration from Pydantic, who in April this year put all their essential tutorials under 19 headings called concepts. Each of these was a keyword that any developer using Pydantic would recognise.

I decided to do the same. Over about three weeks, I reorganised all the lessons, titling them by concept rather than activity and consolidating them into 19 concepts, some of which had dependencies. The key was naming the concepts with basic terms that most students would easily recognise.

Features powered by the concept map

Concept view in the teacher dashboard

The next question is what the teacher can learn from the exercises students complete. Tagging exercises with concepts lets us look across a student's work. Instead of only seeing which exercises they have completed, the teacher can see how that work relates to loops, functions, dictionaries and the other ideas being taught.

The Students × Concepts dashboard: a grid of students against concepts, coloured by fluency, with "Concepts to focus on" and "Individual attention" panels

The teacher's Concepts dashboard, shown here for a Greedy Pig class. It brings together students' work by concept and highlights possible areas for whole-class or individual attention.

There are two useful questions here: how much relevant work has a student completed, and how did that work go? The dashboard separates coverage from signals such as time to completion, hints and repeated unsuccessful attempts.

A student who has barely started needs a different response from one who has worked through most of the relevant exercises and is still struggling. These signals give the teacher a starting point for a conversation or a closer look at the student's code.

They do not, on their own, prove understanding. That matters especially when students can use AI to produce working code.

AI-assisted pop quizzes

The concept tags also give teachers a basis for creating focused quizzes.

The pop quiz builder: concepts the class is ready to be assessed on are ticked on the left, and the AI generates a quiz from them

The Pop Quiz dashboard shows which concepts most of the class has covered. Teachers can select concepts and generate a draft quiz containing multiple-choice questions and short coding exercises, then review it before students see it.

The quiz builder suggests concepts based on how much relevant work the class has completed. The teacher can adjust the selection and choose the mix of questions, including how many should be challenging.

This creates a useful connection between practice and assessment. If the class has worked through exercises involving dictionaries, the teacher can follow up with questions that check what students understand about dictionaries. Completion gives us a reason to check; the quiz gives us another source of evidence.

Less and less wrong

The concept map has proven remarkably useful, despite the fact that no two programmers could ever agree on where one concept begins and another ends, especially in a high-level language like Python. That said, I am putting it out there to be criticised, and hopefully, over time, it will get less and less wrong.

Comments are restricted to teachers only and moderated for child safety reasons.