Document
Document
Variables in Python are used to store data values. They are created when you
assign a value to them, and you don’t need to declare their type (Python is
dynamically typed).
```python
```
- Variable names can contain letters (a-z, A-Z), numbers (0-9), and
underscores (_).
#### **Example:**
```python
Age = 25
Name = “John”
Is_student = True
```
Python has various built-in data types. Some common ones are:
- **int**: For integers (e.g., 1, -3, 100)
You can use the `type()` function to check the type of a variable.
```python
X = 10
```
Python allows you to convert between data types using functions like `int()`,
`float()`, `str()`, etc.
#### **Example:**
```python
X = “10” # x is a string
```
- `+` (Addition)
- `-` (Subtraction)
- `*` (Multiplication)
- `/` (Division)
- `%` (Modulus)
- `**` (Exponentiation)
#### **Examples:**
```python
A = 10
B=3
Print(a + b) # Output: 13
Print(a – b) # Output: 7
Print(a * b) # Output: 30
```
#### **Example:**
```python
X, y, z = 10, 20, 30
Print(x) # Output: 10
Print(y) # Output: 20
Print(z) # Output: 30
```
You can also assign the same value to multiple variables in one line:
```python
X = y = z = 100
```
You can change the value of a variable at any point in your program.
#### **Example:**
```python
X=5
Print(x) # Output: 5
X = 10
Print(x) # Output: 10
```
### **Homework**
1. **Arithmetic Practice:**
Write a Python program that swaps the values of two variables with and
without using a third variable.
3. **Build in Public:**
Create a post on Linkedin/X and share that you learn variables and data
types in python and its day 1. (Use #engineeringinkannada and mention me)
Make sure to subscribe to the channel for more Python tutorial and updates!