CODE PATH
PRO ACCOUNT

Master Code
On The Go

Learn. Practice. Build.

Quest 1 β€’ Lesson 2

πŸ“¦ Variables & Data Types

In Python, a variable is like a labeled box where you can store data. You can create a variable by giving it a name and assigning a value using the = sign.

"Variables store values that can be used and changed throughout your program."
variables.py
name = "Khurram"
age = 25
height = 5.9
is_student = True

print(name)
print(age)
print(height)
print(is_student)

🧠 Python Data Types

Python automatically detects the data type based on the value you assign.

✨ Challenge: Personal Details

Create variables to store your city (string), zip code (integer), and temperature (float). Then print them.

city = "Rawalpindi"
zip_code = 54000
temp = 30.5

print(city)
print(zip_code)
print(temp)

πŸ” Bonus: Check a Variable's Type

Use the built‑in type() function.

age = 25
print(type(age)) # Output: <class 'int'>

❀️ Support Free Education

This course is 100% free. If it helps you, consider buying me a coffee.

β˜• Buy Me a Coffee

➑️ Ready for more?

Next lesson: Working with Numbers & Strings – operations and formatting.

Continue to Lesson 1.3 β†’

(Coming soon – check back or buy Pro Pack for instant access)