Lets Start Python Programming For Beginners. Variables and Data Types, Lectures 2
π Variables and Data Types
π― Goal
By the end of this lecture, you will:
- Understand what a variable is.
- Know how to store different types of data (numbers, words, yes/no).
- Be able to print and use variables in simple code.
π§ What is a Variable?
A variable is like a labeled box where you can store information.
π¦ For example:
- You can put your name in a box called
name
. - Put your age in a box called
age
.
In Python, we do this like:
name = "Alice"
age = 10
This means:
- The word
"Alice"
is stored in the variablename
. - The number
10
is stored in the variableage
.
π‘ Naming Rules for Variables
You can name your boxes (variables) almost anything, but follow these rules:
β Good names:
name
score
player_1
π« Bad names:
1player
β (can’t start with a number)my-name
β (no dashes)print
β (donβt use special Python words)

π’ Types of Data
There are three main types of data weβll use:
Type | Example | Description |
---|---|---|
str | "Hello" | Text (called a string) |
int | 10 | Whole numbers |
float | 3.14 | Decimal numbers |
bool | True /False | Yes or No (true or false) |
Letβs look at each one!
π Strings (str
) β Words and Sentences
We use quotes to make strings:
greeting = "Hi there!"
name = "Bob"
To show them on screen:
print(greeting)
print("My name is", name)
π Output:
Hi there!
My name is Bob
π§ Kids Corner: Think of strings like labels on your lunchbox β they tell you whatβs inside!
β Numbers: Integers (int
) and Floats (float
)
Integers β Whole Numbers
score = 100
lives = 3
Floats β Decimal Numbers
height = 1.5
price = 9.99
Try printing them:
print("Your score is", score)
print("Price:", price)
π Output:
Your score is 100
Price: 9.99
β
Boolean (bool
) β True or False
Booleans are used to say YES or NO:
is_student = True
has_key = False
You can print them too:
print("Are you a student?", is_student)
π Output:
Are you a student? True
π Changing the Value of a Variable
You can change whatβs inside the box anytime:
name = "Alice"
print(name)
name = "Emma"
print(name)
π Output:
Alice
Emma
π§ͺ Try It Yourself!
Write code that does the following:
- Stores your name in a variable called
name
. - Stores your favorite number in
favorite_number
. - Prints both out like this:
My name is Alice.
My favorite number is 7.
π‘ Tip: Use commas to print multiple things.
π§ Kids Corner
π§ Imagine your computer is a robot with memory boxes. When you say:
name = "Tom"
It’s like putting a sticky note labeled βnameβ on a box that says βTomβ.
π€ Robot thinks:
βI remember Tom!β
[adrotate banner=”3″]
π Challenge (Optional)
Can you write a sentence using all these variables?
animal = "dog"
color = "brown"
number = 3
Example output:
I saw a brown dog today. It was the 3rd one I saw!
π Summary
- A variable stores data like a labeled box.
- Common types:
str
,int
,float
,bool
. - You can change the value of a variable anytime.
- Use
print()
to show whatβs inside the box.
πΉ Call Of Action
If this article was helpful to you, please Share and leave your feedback in the comment section below.
Python Programming For Beginners To Advanced
Python Programming For Beginners! Lecture 1
Python Programming! Variables and Data Types | Lectures 2
Python Programming! Input And Output | Lectures 3
Python Programming! Operators in Python Lectures 4
Python Programming! Conditional Statements Lectures 5