🐍 Python Learning Hub

Session 1: Guessing Game+ β€” loops, conditionals & functions

Everything for this session lives on this one page β€” play, learn, quiz, remember.

Session progress0 of 3

Play a round, finish the quiz, then complete the solo challenge.

01 Β· PLAY IT

Guessing Game+

Learn the logic by feeling it first. Invalid input is free; a valid wrong guess costs one life.

7 lives
Score: 0 win(s) out of 0 round(s).
Press Enter or tap Guess.
02 Β· READ IT

Follow the Python

Tap a concept to highlight the exact lines that make it work.

Choose a concept above. Its lines will light up here.


      
03 Β· REVIEW IT

Code review β€” your turn

Predict the program before checking. That is how reading code becomes a skill.

1. The secret is 42. The player types abc, then 150, then 50. How many lives remain?

2. What does continue do on the out-of-range line?

3. Spot every bug in this variant:

while lives > 0:
    guess = int(input("Your guess: "))
    if guess == secret:
        print("Correct!")
    lives -= 1
    hint = "higher" if guess < secret else "lower"
    print(f"Nope - go {hint}!")
04 Β· REMEMBER IT

Five sticky concepts

Tap each card to flip it. Say the explanation out loud before you reveal the back.

05 Β· BUILD IT

Solo challenge: hot_cold.py

Write this one yourself. Borrow patterns, not whole answers.

Pick a secret number 1–20, give the player 5 tries. After each guess print Hot! if within 3 of the secret, else Cold!. Show a win message on a correct guess and reveal the number on a loss.

Three nudges

  • Use random.randint like the game above.
  • abs(guess - secret) <= 3 means hot.
  • Reuse the validation pattern: isdigit + continue.
THE COMPLETE JOURNEY

Sessions 2–9

Open one session at a time. Each has a playable browser demo, a runnable Python lesson example based on that demo, a code-reading quiz, flashcards, and a solo build.

Practice activities tried this visit
0 of 36 This counter resets on reload. It records attempts, not mastery.
CODE READING GYM

Train your code-reading eyes

Do not run the code first. Trace it line by line, predict the output, then check the walkthrough. That habit is how unfamiliar code stops feeling unfamiliar.

KEEP IT CLOSE

Python cheat sheet

A plain-English reminder of the ideas used across the journey. Read the tiny example, then look for the same shape in a project.

THE 9-SESSION ARC

Your Python roadmap

Sessions 2–9 are available in the interactive lessons above. Sessions 8–9 share one combined capstone.

SESSION 1YOU ARE HERE

Guessing Game+

Console Β· loops, conditionals, random

SESSION 2AVAILABLE

High-score keeper

Files Β· save/load scores; refactor into functions

SESSION 3AVAILABLE

Word counter

Dictionaries Β· analyze real text

SESSION 4AVAILABLE

File toolkit

Files Β· shout, reverse, stat-pack any text file

SESSION 5AVAILABLE

RPSLS arena

Complex data structures Β· nested dicts as game rules

SESSION 6AVAILABLE

Scrabble scorer

Advanced files Β· multi-file letter values