
*_Let’s go through important Python Topics Everyday starting with the first one today_*
*Variables & Data Types in Python*
What are Variables?
Variables are used to store data so you can refer to it and manipulate it later in your code. You don’t need to declare the type of variable explicitly in Python — it figures it out based on the value you assign.
Example:
x = 10 name = “Alice” price = 19.99 is_active = True
Data Types in Python
int – Integer numbers
Example: x = 5
float – Decimal numbers
Example: pi = 3.14
str – String or text
Example: name = “John”
bool – Boolean values (True or False)
Example: is_logged_in = False
list – An ordered, changeable collection
Example: fruits = [“apple”, “banana”, “cherry”]
tuple – An ordered, unchangeable collection
Example: coordinates = (10, 20)
set – An unordered collection of unique items
Example: unique_ids = {1, 2, 3}
dict – A collection of key-value pairs
Example: person = {“name”: “Alice”, “age”: 25}
ENJOY LEARNING 👍👍