🐍 Python Variables & Data Types — Lesson 2 | CodeWithRT
👋 Welcome back to CodeWithRT, where coding becomes fun and easy!
Agar tumne pehla post pada tha (“Python Basics for Beginners”) — toh ab time hai next step ka 🚀
🔹 What Are Variables?
Variables are like containers that store information — just like a box that holds your stuff 🎁
In Python, you don’t need to declare the type of variable — Python automatically understands it 😎
Example 👇
💬 Output:
My name is Rihan I’m 19 years old and I live in Pune
Simple, right? 🧠
🔠 Rules for Writing Variables
✅ Variable names can have letters, numbers, and underscores
✅ They can’t start with a number
✅ They are case-sensitive (Name and name are different)
✅ No spaces or special characters allowed
Good 👍
user_name = "Rihan"
age2 = 19
Bad ❌
2age = 19
user name = "Rihan"
💡 What Are Data Types?
Data types tell Python what kind of data a variable holds.
There are many, but here are the most common ones 👇
Type Example Meaning
String (str) "Hello" Text
Integer (int) 19 Whole number
Float (float) 3.14 Decimal number
Boolean (bool) True / False Yes or No values
Example:
Input:
name = "Rihan" # String
age = 19 # Integer
height = 5.9 # Float
is_student = True # Boolean
print(type(name))
print(type(age))
print(type(height))
print(type(is_student))
💬 Output:
<class 'str'>
<class 'int'>
<class 'float'>
<class 'bool'>
🧩 Quick Practice Task
Try this small challenge 👇
👉 Make variables for your own name, age, favorite color, and hobby.
Then print them all together using one print() statement 😄
🔮 Coming Next — Lesson 3
Operators in Python ➕➖✖️➗
We’ll learn how Python does math, logic, and comparisons in simple steps.
💭 Comment Below:
“What’s your favorite data type and why?” 😅
📢 Share this post if you found it helpful —
on 👉 WhatsApp, Telegram, or LinkedIn
Let’s make Python simple for everyone 💻
— CodeWithRT


0 Comments