✅ Python Basics: Part-1
Data Types & Variables 🐍📚
🎯 What is a Variable?
A variable stores data in memory to be used and modified later.
Example:
name = "Alice"
age = 25
🔹 Common Python Data Types:
● String (str) – Text data
message = "Hello, World"
● Integer (int) – Whole numbers
count = 42
● Float (float) – Decimal numbers
price = 19.99
● Boolean (bool) – True or False
is_valid = True
● List (list) – Ordered, mutable sequence
fruits = ["apple", "banana", "cherry"]
● Tuple (tuple) – Ordered, immutable sequence
coords = (10.5, 20.7)
● Set (set) – Unordered collection of unique elements
colors = {"red", "green", "blue"}
● Dictionary (dict) – Key-value pairs
person = {"name": "Alice", "age": 25}
🔑 Dynamic Typing:
Python automatically detects the type, so you don’t need to declare it.
💬 Double Tap ❤️ for Part-2!
Post #2584
3.17K
- ❤ 59
- 👍 1