Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
← PYTHON FUNDAMENTALS LEVEL ONE PROFESSIONAL Β· Lesson 3 of 8

Module Two

πŸ“– Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
3
Module 2 Β· Variables & Data Types Β· Python for 13-year-olds

πŸ“¦ Module 2 Β· Variables & Data Types

πŸ§‘β€πŸŽ“ for 13-year-olds store & play with data Β· 45 min
🧠 int · float · str · bool

Hey again, coder! πŸŽ‰ In Module 1 you wrote your first program. Now it’s time to make Python remember things β€” like your score in a game, your name, or whether you’re hungry (always true πŸ•). We’ll use variables and learn the four basic data types. Let’s dive in!

1

What is a variable? πŸ“¦

Think of a variable as a labelled box πŸ“¦. You put something inside and give the box a name. Later, you can look inside the box by using its name. In Python, you create a variable with the = sign (called assignment).

# my first variables
name = "Alex"
age = 13
print(name)
print(age)
πŸ’‘ Pro tip: Variable names should be lowercase, use underscores for spaces (my_score), and can’t start with a number.
2

The 4 basic data types 🎨

Every value in Python has a type. Here are the four you’ll use most:

TypeNameExampleWhat it's for
intInteger42Whole numbers
floatFloat3.14Decimal numbers
strString"hello"Text (in quotes)
boolBooleanTrue / FalseYes/No values

You can check any value’s type using type():

print(type(42))
# <class 'int'>
3

Numbers: int & float πŸ”’

Python can do math for you! Integers are whole numbers, floats have decimals. Try this in the REPL or a new file:

# numbers
apples = 7
price = 2.50
total = apples * price
print(total) # 17.5

# watch out for integer division!
print(10 / 3) # 3.333...
print(10 // 3) # 3 (floor division)
print(10 % 3) # 1 (remainder)
4

Strings: text magic ✨

A string is text inside quotes (single ' or double "). You can glue strings together with +, repeat them with *, and even insert variables using f-strings.

first = "Alex"
last = "Rivers"
full = first + " " + last
print(full) # Alex Rivers

# f-string (super handy!)
age = 13
print(f"Hi {first}, you are {age} years old!")
✨ f-strings start with f" and let you put variables inside {}.
5

Booleans: True or False βœ…βŒ

A boolean can only be True or False (capital first letter!). You’ll use them for decisions like β€œis the game over?” or β€œdo I have pizza?”

is_sunny = True
is_raining = False
has_pizza = True
print("Pizza time?", has_pizza)

# comparisons give booleans
print(10 > 5) # True
print(3 == 4) # False
6

Converting between types πŸ”„

Sometimes you need to change a type. Use int(), float(), str(), or bool(). This is called type casting.

# string to int
num_text = "25"
num = int(num_text)
print(num + 5) # 30

# int to string (for gluing)
score = 100
print("Your score: " + str(score))
⚠️ Watch out: int("hello") will crash β€” you can only convert numbers written as text!

πŸ† Mini challenge: Your dream pet

Create a file called my_pet.py. Make variables for your dream pet: its name (string), its age (integer), how tall it is in metres (float), and whether it can fly (boolean). Then print a fun sentence using an f-string.

# Example – change the values to your own!
pet_name = "Sparky"
pet_age = 2
pet_height = 1.25
can_fly = True

print(f"{pet_name} is {pet_age} years old, {pet_height}m tall, and it can fly: {can_fly}.")

🎨 Get creative β€” make it a dragon, a robot, or a flying pizza! Bonus: use type() to print the type of each variable.

πŸ§‘β€πŸ« Remember: Variables are boxes, types are what’s inside. Play around β€” mistakes are how you learn!

πŸ† Get Certified

πŸ”’

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (₦2,000 or 20,000 coins), and get a verified certificate with your name on it.

πŸŽ“ Sign Up to Get Certified
πŸ› οΈ Practice Tools
Hands-on simulators & labs - subscription required.
β†’
🎯 Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
β†’