Python Mastery — Phase 1: Basics Variables & Data Types
Python Mastery
Phase 1 — Variables & Data Types
A complete beginner's guide · Written for 10th grade and up
What is programming?
Programming is giving instructions to a computer. Just like you give step-by-step directions to a friend,
you give step-by-step instructions to a computer — except the computer follows them exactly, every
single time.
Python is one of the most popular programming languages in the world. It is used to build websites,
apps, AI tools, and much more. The best part? It reads almost like plain English.
1. Variables
Think of a variable as a labelled box. You give the box a name, put something inside it, and you can
come back and use whatever is inside whenever you need it.
Real-life analogy
Imagine a jar with a label that says "score". You put the number 10 inside it.
Later, when you say "score", Python opens that jar and gives you 10.
You can also change what is inside the jar at any time.
Syntax: variable_name = value (the = sign means "store this value")
Your first variables
# The # symbol is a comment — Python ignores it
# Use comments to explain what your code does
name = "Arun" # Storing a name
age = 20 # Storing a number
city = "Chennai" # Storing a city
print(name) # Output: Arun
print(age) # Output: 20
print(city) # Output: Chennai
Changing a variable
You can update a variable any time. Python always uses the most recent value.
score = 0
Beginner's Python Notes | Phase 1 of 5 | Page 1
Python Mastery — Phase 1: Basics Variables & Data Types
print(score) # Output: 0
score = 50
print(score) # Output: 50
score = 100
print(score) # Output: 100
2. Data types
Every piece of data in Python has a type. Python figures out the type automatically — you don't need to
declare it. There are 4 basic types you need to know right now:
Type Example value What it means Check with type()
int 20, -5, 0 Whole numbers. No decimal point. <class 'int'>
float 9.99, 3.14 Numbers with decimal points. <class 'float'>
str "Hello", 'Arun' Text. Always inside quotes. <class 'str'>
bool True, False Only two values. Used for yes/no. <class 'bool'>
How to check a type
Use the built-in type() function to check what type a variable is.
Example: type(age) gives you <class 'int'>
Example: type(name) gives you <class 'str'>
You will use this a lot when debugging your code.
Seeing types in action
name = "Arun" # str — text
age = 20 # int — whole number
score = 98.5 # float — decimal number
passed = True # bool — True or False
print(type(name)) # <class 'str'>
print(type(age)) # <class 'int'>
print(type(score)) # <class 'float'>
print(type(passed)) # <class 'bool'>
3. F-strings — putting variables into text
An f-string lets you mix variables directly into a sentence. You put an f before the opening quote, and
wrap any variable in curly braces { }.
name = "Arun"
Beginner's Python Notes | Phase 1 of 5 | Page 2
Python Mastery — Phase 1: Basics Variables & Data Types
age = 20
city = "Chennai"
# Without f-string (old way, harder to read):
print("My name is " + name + " and I am " + str(age))
# With f-string (clean and easy):
print(f"My name is {name} and I am {age} years old")
# Output: My name is Arun and I am 20 years old
print(f"I live in {city}")
# Output: I live in Chennai
Remember this rule
The f goes right before the opening quote — no space.
Any variable goes inside { } curly braces inside the string.
Python replaces {variable} with its actual value when printing.
4. Naming rules for variables
Variable names have rules. Break these rules and Python will give you an error.
Variable name Valid? Reason
my_name Yes Lowercase letters + underscore. Perfect.
age Yes Short, clear, lowercase. Great choice.
score2 Yes Numbers are fine — just not at the start.
2score No Cannot start with a number.
my name No Spaces are not allowed. Use underscore.
My-Score No Hyphens are not allowed. Use underscore.
Best practice: use lowercase letters and underscores for all variable names. This style is called
snake_case and it is the Python standard.
5. Common beginner mistakes
Everyone makes these mistakes. Knowing them in advance saves you time.
Mistake 1 — Forgetting quotes around text
Wrong: name = Arun
Right: name = "Arun"
Beginner's Python Notes | Phase 1 of 5 | Page 3
Python Mastery — Phase 1: Basics Variables & Data Types
Without quotes, Python thinks Arun is another variable name, not text.
Mistake 2 — Mixing types without converting
Wrong: print("I am " + 20)
Right: print("I am " + str(20)) or use an f-string
You cannot join text and a number directly. Use str() to convert the number first.
Mistake 3 — Typos in variable names
If you store something as "my_name" but later type "myname", Python says it doesn't exist.
Python is case-sensitive: name, Name, and NAME are three different variables.
6. Practice exercises
The only way to really learn programming is to write code yourself. Try these exercises — no peeking
at answers first!
Exercise 1 — Create your profile
Create variables to store your name, age, city, and favourite subject. Then print them all in a sentence
using f-strings.
# Your code here:
my_name = ___
my_age = ___
my_city = ___
my_subject = ___
print(f"My name is {my_name}...")
Exercise 2 — Check the types
Create one variable of each type (int, float, str, bool), then use type() to print each one.
Exercise 3 — Update a variable
Create a variable called score with value 0. Then update it to 10, then 25, then 50. Print it after each
change.
7. Quick reference card
Keep this page bookmarked. These are the most-used patterns from this lesson.
Beginner's Python Notes | Phase 1 of 5 | Page 4
Python Mastery — Phase 1: Basics Variables & Data Types
# === CREATING VARIABLES ===
name = "Your name" # str
age = 16 # int
gpa = 9.5 # float
passed = True # bool
# === PRINTING ===
print(name) # simple
print(f"I am {age} years old") # f-string
# === CHECKING TYPE ===
print(type(age)) # <class 'int'>
# === UPDATING ===
score = 0
score = 100 # score is now 100
# === VALID NAMES ===
my_name = "Arun" # good
score2 = 99 # good
# 2score = 99 # BAD - starts with number
# my name = "Arun" # BAD - has a space
What comes next?
You have completed Lesson 1 of Phase 1. Here is what is coming up next in your journey:
• Lesson 2 — Input & Arithmetic: taking input from the user, doing math with variables
• Lesson 3 — Conditions (if/elif/else): making decisions in your code
• Lesson 4 — Loops (for & while): repeating actions
• Lesson 5 — Lists: storing multiple values in one variable
YouTube tip
For your channel: record yourself doing the exercises above — live, unedited.
When you get confused or make a mistake, keep recording. That is the best content.
Your viewers are beginners too. They will learn from watching you figure things out.
Keep going. Consistency beats talent every time.
Beginner's Python Notes | Phase 1 of 5 | Page 5