Python Basics: Data Types & Variables

✅ *Python Basics: Part-1* *Data Types & Variables* 🐍📚 🎯 *What is a Variable?* A *variable* stores data in memory to be used and modified later. Example: ```python name = "Alice" age = 25 ``` 🔹 *Common Python Data Types:* ● *String (`str`)* – Text data ```python message = "Hello, World" ``` ● *Integer (`int`)* – Whole numbers ```python count = 42 ``` ● *Float (`float`)* – Decimal numbers ```python price = 19.99 ``` ● *Boolean (`bool`)* – True or False ```python is_valid = True ``` ● *List (`list`)* – Ordered, mutable sequence ```python fruits = ["apple", "banana", "cherry"] ``` ● *Tuple (`tuple`)* – Ordered, *immutable* sequence ```python coords = (10.5, 20.7) ``` ● *Set (`set`)* – Unordered collection of unique elements ```python colors = {"red", "green", "blue"} ``` ● *Dictionary (`dict`)* – Key-value pairs ```python 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!*

To view or add a comment, sign in

Explore content categories