Coding - Python Lesson 1
Coding - Python Lesson 1
---
- **Script Mode**: Write code in a file with a `.py` extension and run it.
---
## **Lesson 2: Python Syntax and Basics**
```python
print("Hello, world!")
```
Output:
```
Hello, world!
```
```python
age = 25 # Integer
```
```python
---
```python
x = 10
y=3
print(x + y) # Addition
print(x - y) # Subtraction
print(x * y) # Multiplication
print(x / y) # Division
print(x % y) # Modulus
```
```python
else:
print("You are a child.")
```
### **Loops**
```python
for i in range(5):
print("Iteration:", i)
```
```python
count = 0
print("Count:", count)
count += 1
```
---
```python
def greet(name):
print("Hello,", name)
greet("Alice")
```
### **Lists**
```python
print(fruits)
```
---
### **Dictionaries**
```python
print(person["name"])
```
try:
except ValueError:
```
---
## **Review Questions**