|
| 1 | +### **Day 1: Introduction to Python** |
| 2 | +- Python is a high-level, interpreted programming language known for its readability and simplicity. |
| 3 | +- It is versatile and widely used in various domains, including web development, data analysis, artificial intelligence, and more. |
| 4 | +- Python code is executed line by line, making it an excellent choice for beginners. |
| 5 | +- Example: |
| 6 | + |
| 7 | +```python |
| 8 | +# This is a simple Python program that prints a message |
| 9 | +print("Hello, World!") |
| 10 | +``` |
| 11 | + |
| 12 | +### **Day 2: Variables and Data Types** |
| 13 | +- Variables are used to store and manipulate data in Python. |
| 14 | +- Python supports various data types, including: |
| 15 | + - Strings (text): `name = "John"` |
| 16 | + - Integers (whole numbers): `age = 30` |
| 17 | + - Floats (decimal numbers): `height = 6.1` |
| 18 | + - Lists (ordered collections of items): `fruits = ["apple", "banana", "cherry"]` |
| 19 | + - Tuples (immutable, ordered collections): `point = (3, 4)` |
| 20 | + - Dictionaries (key-value pairs): `person = {"name": "Alice", "age": 25}` |
| 21 | +- Variables are dynamically typed, meaning their data type can change during runtime. |
| 22 | +- Example: |
| 23 | + |
| 24 | +```python |
| 25 | +name = "John" |
| 26 | +age = 30 |
| 27 | +height = 6.1 |
| 28 | +fruits = ["apple", "banana", "cherry"] |
| 29 | +person = {"name": "Alice", "age": 25} |
| 30 | +``` |
| 31 | + |
| 32 | +### **Day 3: Conditional Statements and Loops** |
| 33 | +- Conditional statements allow your code to make decisions based on conditions. |
| 34 | +- Common conditional statements include `if`, `elif` (else if), and `else`. |
| 35 | +- Loops, such as `for` and `while`, are used for repetitive tasks. |
| 36 | + |
| 37 | +**Conditional Statements:** |
| 38 | +```python |
| 39 | +x = 10 |
| 40 | +if x > 5: |
| 41 | + print("x is greater than 5") |
| 42 | +elif x == 5: |
| 43 | + print("x is equal to 5") |
| 44 | +else: |
| 45 | + print("x is less than 5") |
| 46 | +``` |
| 47 | + |
| 48 | +**For Loop:** |
| 49 | +- For loops are used to iterate over a sequence (e.g., a list or string). |
| 50 | +- Example: |
| 51 | + |
| 52 | +```python |
| 53 | +fruits = ["apple", "banana", "cherry"] |
| 54 | +for fruit in fruits: |
| 55 | + print("I love " + fruit) |
| 56 | +``` |
| 57 | + |
| 58 | +**While Loop:** |
| 59 | +- While loops continue executing as long as a specified condition is True. |
| 60 | +- Example: |
| 61 | + |
| 62 | +```python |
| 63 | +count = 0 |
| 64 | +while count < 5: |
| 65 | + print("Count: " + str(count)) |
| 66 | + count += 1 |
| 67 | +``` |
| 68 | + |
| 69 | +These examples provide a deeper understanding of Python's core concepts. Make sure to run them in a Python environment to see the results. You can install Python by downloading it from the official Python website [**python.org**](https://www.python.org/downloads/). After installation, you can use a code editor or Python's built-in IDLE to write and run Python code. |
| 70 | + |
| 71 | +These foundational concepts will serve as the building blocks for your Python journey. Continue to explore and experiment with Python to solidify your understanding and become a proficient Python programmer. |
0 commit comments