0Pricing
Coding for Kids · Lesson

Random Numbers

Pick a number in a range.

Random Numbers is a free Coding for Kids lesson on CoddyKit — lesson 2 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.

Random Numbers 🔢

Let us pick random numbers in any range we want! Great for dice, scores, and lucky draws. 🎲

randint Range 📏

random.randint(low, high) picks a whole number from low to high, including both!

import random
print(random.randint(1, 10))

Dice Roll 🎲

A dice goes from 1 to 6.

import random
roll = random.randint(1, 6)
print("You rolled:", roll)

Bigger Range 🌍

Pick from 1 to 100!

import random
print(random.randint(1, 100))

Two Rolls 🎲🎲

Roll twice and add them up!

import random
a = random.randint(1, 6)
b = random.randint(1, 6)
print(a + b)

Random with Step 🪜

random.randrange(0, 10, 2) picks even numbers like 0, 2, 4...

import random
print(random.randrange(0, 10, 2))

Lucky Score 🏆

Give a player a random bonus score!

import random
bonus = random.randint(10, 50)
print("Bonus:", bonus)

Negative Numbers ❄️

The low number can be negative too!

import random
print(random.randint(-5, 5))

Save and Use 💾

Store a random number, then do math with it.

import random
n = random.randint(1, 9)
print(n * 2)

Guess Setup 🤔

Make a secret number for a guessing game!

import random
secret = random.randint(1, 5)
print("Secret is between 1 and 5")

Ranges Rule 💡

You choose the low and high, and Python picks a surprise inside. Perfect for any game! 🎮

Quick Check ✅

Number brain snack! 🍪

Number Ninja! 🌟

You can pick random numbers in any range with randint(low, high). Both ends are included! Roll on! 🎲🎉

Frequently asked questions

Is the “Random Numbers” lesson free?

Yes — the full text of “Random Numbers” 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 “Random Numbers”?

Pick a number in a range. 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 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Random Numbers” 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