Today I focused on strengthening my Python fundamentals, which are essential for building a solid base in data analytics and problem-solving.
🔹 Topics I Explored
1️⃣ List
- Definition: A list is a collection of ordered and mutable elements in Python.
- Example:
fruits = ["apple", "banana", "cherry"] print(fruits) 2️⃣ Tuple
- Definition: A tuple is a collection of ordered and immutable elements.
- Example:
colors = ("red", "green", "blue") print(colors) 3️⃣ Dictionary
- Definition: A dictionary stores key–value pairs and is mutable.
- Example (Student Details Program):
# Create Dictionary students = { 1: {"name": "Ramya", "age": 21}, 2: {"name": "Visky", "age": 22} } # Add students[3] = {"name": "Maha", "age": 23} # Update students[2]["age"] = 23 # Delete del students[1] # View print(students) 🔹 Additional Concepts Learned
4️⃣ Homogeneous vs Heterogeneous
- Homogeneous: All elements are of the same data type. Example:
[1, 2, 3, 4] - Heterogeneous: Elements are of different data types. Example:
[1, "Ramya", 3.5, True]
5️⃣ Ternary Operator
- Definition: A shorthand way of writing an
if-elsecondition in one line. - Example:
age = 18 result = "Adult" if age >= 18 else "Minor" print(result) 6️⃣ Recursion
- Definition: A function calling itself to solve a smaller version of the same problem.
- Example (Factorial Program):
def factorial(n): if n == 0: return 1 else: return n * factorial(n - 1) print("Factorial of 5:", factorial(5)) 7️⃣ Stack
- Definition: A LIFO (Last In First Out) data structure.
- Example:
stack = [] stack.append(10) stack.append(20) stack.pop() print(stack) 8️⃣ Queue
- Definition: A FIFO (First In First Out) data structure.
- Example:
from collections import deque queue = deque() queue.append(10) queue.append(20) queue.popleft() print(queue) 🔹 Bonus Practice — Sum of First 5 Natural Numbers Using Recursion
def sum_natural(n): if n == 0: return 0 else: return n + sum_natural(n - 1) print("Sum of first 5 natural numbers:", sum_natural(5)) 💬 Reflection
Today’s learning helped me deeply understand data structures, control flow, and recursion logic, which form the backbone of Python programming and data analysis.

Top comments (0)