0Pricing
Coding for Kids · Lesson

Higher or Lower

Give hints.

Higher or Lower is a free Coding for Kids lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Coding for Kids learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Give Helpful Hints! 💡

Hi helper! 💡 A great guessing game gives HINTS! If the guess is wrong, we tell the player: go HIGHER or go LOWER! 📈📉

Let's make our game smart and helpful!

print('Too high? Too low? I will help you! 💡')

Greater Than Sign 📈

The symbol > means "greater than" (bigger). 📈 So guess > secret asks: is the guess bigger than the secret?

guess = 8
secret = 5
if guess > secret:
    print('Your guess is too HIGH! Go lower! 📉')

Less Than Sign 📉

The symbol < means "less than" (smaller). 📉 So guess < secret asks: is the guess smaller?

guess = 3
secret = 5
if guess < secret:
    print('Your guess is too LOW! Go higher! 📈')

Three Possibilities 🔀

A guess can be: too high, too low, or just right! We check all three with if, elif, and else! 🔀

guess = 4
secret = 5
if guess > secret:
    print('Too high! 📉')
elif guess < secret:
    print('Too low! 📈')
else:
    print('Just right! 🎉')

Try the Hints 🎯

Change the guess below to 2, then 9, then 5 and run each time to see all three hints! 🎯

guess = 9
secret = 5
if guess > secret:
    print('Lower! 📉')
elif guess < secret:
    print('Higher! 📈')
else:
    print('Correct! 🎉')

Hints With Real Guesses 🗣️

Now let's get a REAL guess from the player and give a hint! 🗣️

import random
secret = random.randint(1, 20)
guess = int(input('Guess 1-20: '))
if guess > secret:
    print('Too high! 📉')
elif guess < secret:
    print('Too low! 📈')
else:
    print('You got it! 🎉')

Hints in a Loop 🔁

Hints are most useful over MANY tries! Let's give hints each turn in a loop. 🔁 The player gets closer and closer!

secret = 7
for tries in range(3):
    guess = int(input('Guess 1-10: '))
    if guess > secret:
        print('Too high! 📉')
    elif guess < secret:
        print('Too low! 📈')
    else:
        print('Correct! 🎉')

Warmer and Colder 🔥❄️

We could also say "warmer" or "colder"! But higher/lower is the clearest hint for numbers. 🔥❄️ Stick with it for now!

guess = 6
secret = 8
if guess < secret:
    print('Getting warmer, go higher! 🔥📈')

Counting Down Tries ⏳

We can tell the player how many tries are LEFT! This adds excitement. ⏳

total = 3
for tries in range(total):
    left = total - tries
    print('You have', left, 'tries left! ⏳')
    guess = int(input('Guess: '))

Smart Game Together 🧠

Here's a smart game with random secret, real guesses, hints, and limited tries — all in one! 🧠

import random
secret = random.randint(1, 20)
for tries in range(4):
    guess = int(input('Guess 1-20: '))
    if guess > secret:
        print('Lower! 📉')
    elif guess < secret:
        print('Higher! 📈')
    else:
        print('You win! 🏆')

Hint Master! 🚀

You can now guide players to the answer with smart hints! 🚀 This makes games fun AND fair. Try it with different secrets!

guess = 12
secret = 15
if guess < secret:
    print('Go higher! 📈')
else:
    print('Go lower! 📉')

Quick Check! 🧠

Test your hint-giving skills! 💡

Hints Champion! 🎉

Excellent! 🎉 Your game gives smart hints!

  • > means greater than (too high) 📉
  • < means less than (too low) 📈
  • if/elif/else covers all three cases 🔀
  • Hints in a loop guide the player 🔁

Next: celebrating when they WIN! 🏆

guess = 5
secret = 5
if guess == secret:
    print('Perfect guess! 🎉')

Frequently asked questions

Is the “Higher or Lower” lesson free?

Yes — the full text of “Higher or Lower” is free to read here on the web, and the Coding for Kids course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Coding for Kids course, upgrade to CoddyKit PRO.

What will I learn in “Higher or Lower”?

Give hints. You practise Coding for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Coding for Kids?

No prior experience is required. Coding for Kids on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Higher or Lower” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Coding for Kids lesson?

Yes. Every Coding for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Making a Secret Number
  2. Asking for Guesses
  3. Higher or Lower
  4. You Win!
← Back to Coding for Kids