Basic Python Codes
Basic Python practice codes for 7 days: **Day 1: Variables and Data Types** ```python # Declare a variable and print its value my_variable = 42 print(my_variable) # Perform basic arithmetic operations num1 = 10 num2 = 5 sum_result = num1 + num2 print(sum_result) ``` **Day 2: Conditional Statements** ```python # Create an if-else statement age = 18 if age >= 18: print("You are an adult.") else: print("You are a minor.") # Use comparison operators (>, <, ==, !=) ``` **Day 3: Loops** ```python # Use a for loop to print numbers from 1 to 5 for i in range(1, 6): print(i) # Use a while loop to count down from 5 to 1 count = 5 while count > 0: print(count) count -= 1 ``` **Day 4: Lists** ```python # Create and manipulate lists my_list = [1, 2, 3, 4, 5] print(my_list[0]) # Access an element my_list.append(6) # Add an element my_list.remove(3) # Remove an element print(my_list) ``` **Day 5: Functi...