Coding for Kids · Lesson

A Fortune Teller

Give random fortunes.

Lesson 4 of 413 steps

A Fortune Teller is a free Coding for Kids lesson on CoddyKit. This is lesson 4 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, and your progress syncs across the web and the CoddyKit app. The Coding for Kids course includes 4 lessons in total.

A Fortune Teller 🔮

Let us build a magical fortune teller that gives a random message! Mix lists and random.choice. ✨

A List of Fortunes 📜

First, write some fortunes in a list.

fortunes = ["You will be lucky!", "Adventure awaits!", "Make a new friend!"]
print(fortunes)

Pick a Fortune 🎴

Use random.choice to reveal one!

import random
fortunes = ["Luck!", "Joy!", "Fun!"]
print(random.choice(fortunes))

Add Magic Words ✨

Make it feel special with a message.

import random
fortunes = ["Big win soon!", "A surprise gift!"]
print("Your fortune:", random.choice(fortunes))

More Fortunes 🌟

The more fortunes, the more surprises!

import random
fortunes = ["Star day!", "Be brave!", "Smile more!", "Try again!"]
print(random.choice(fortunes))

Save the Fortune 💾

Store the chosen fortune in a variable.

import random
fortunes = ["Hello!", "Goodbye!"]
my_fortune = random.choice(fortunes)
print(my_fortune)

Ask a Question 🎱

Make a magic 8 ball that answers anything!

import random
replies = ["Yes!", "No!", "Ask later!"]
print("The ball says:", random.choice(replies))

Lucky Number Too 🔢

Add a lucky number to the fortune!

import random
print("Lucky number:", random.randint(1, 9))

Lucky Color 🌈

Tell them their lucky color!

import random
colors = ["gold", "blue", "pink"]
print("Lucky color:", random.choice(colors))

Full Fortune 🔮

Put a fortune AND a lucky number together!

import random
f = random.choice(["Joy!", "Luck!"])
n = random.randint(1, 9)
print(f, "Lucky number:", n)

You Are a Wizard 💡

A fortune teller is just a list plus random.choice. You can make jokes, riddles, or compliments the same way! ✨

Quick Check ✅

Magical brain snack! 🍪

Fortune Wizard! 🌟

You built a fortune teller with a list and random.choice! Add lucky numbers and colors for extra magic. ✨🎉

Free to start

Learn Python with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
35
Lessons
140

Frequently Asked Questions

Is the “A Fortune Teller” lesson free?

Yes — the full text of “A Fortune Teller” is free to read here on the web. 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. The Coding for Kids course includes 4 lessons in total.

What will I learn in “A Fortune Teller”?

Give random fortunes. 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, so you can start here or from the beginning and move at your own pace. This is lesson 4 of 4.

How long does the “A Fortune Teller” 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. The random Module
  2. Random Numbers
  3. Random Choices
  4. A Fortune Teller
← Back to Coding for Kids