Python Syllabus Notes
Python Syllabus Notes
1. Installing Python
2. Using an IDE
- Printing output:
```python
print("Hello World!")
```
- Arithmetic operations:
```python
a, b = 10, 5
print(a + b, a - b, a * b, a / b)
```
- Conditional statements:
```python
x = 10
if x > 5:
print("Greater than 5")
```
- Loops:
```python
for i in range(5):
print(i)
```
6. Conditional Expressions
- Nested Conditions:
```python
x = 10
if x > 5:
if x < 15:
print("Between 5 and 15")
```
- `break`, `continue`, `pass`:
```python
for i in range(5):
if i == 2:
continue # Skips 2
print(i)
```
8. Data Structures
- Lists:
```python
my_list = [1, 2, 3]
print(my_list[0])
```
- Dictionaries:
```python
my_dict = {"name": "Alice", "age": 25}
print(my_dict["name"])
```