**Quick Reference Sheet for Python Programming**
Python is a widely used high-level, interpreted programming language known for its
simplicity and readability. This document provides a concise cheat sheet covering the
essentials for beginners and intermediate users.
**1. Basic Syntax**
```python
print("Hello, World!")
x=5
y = "AI"
```
**2. Data Types**
- int, float, str, bool
- list, tuple, set, dict
```python
my_list = [1, 2, 3]
my_dict = {"name": "Manjeet", "age": 19}
```
**3. Control Structures**
```python
if x > 0:
print("Positive")
elif x == 0:
print("Zero")
else:
print("Negative")
```
**4. Loops**
```python
for i in range(5):
print(i)
while x > 0:
x -= 1
```
**5. Functions**
```python
def greet(name):
return f"Hello, {name}"
```
**6. Lambda Functions**
```python
add = lambda a, b: a + b
```
**7. OOP Basics**
```python
class Car:
def __init__(self, brand):
self.brand = brand
def start(self):
print(f"{self.brand} started")
```
**8. Exception Handling**
```python
try:
x=1/0
except ZeroDivisionError:
print("Cannot divide by zero")
```
**9. Common Libraries**
- **NumPy**: numerical computing
- **Pandas**: data manipulation
- **Matplotlib**: visualization
- **scikit-learn**: machine learning
This reference guide is ideal for students, hobbyists, and professionals looking to refresh
Python knowledge quickly.