Python Basics - ACT
Python Basics - ACT
## Introduction
In this exercise, you will practice using variables and basic operators in Python. Follow the instructions
and complete the code cells.
### Part 1: Variable Assignment
Assign values to variables `a` and `b`. Then, print their values.
```python
# Part 1: Variable Assignment
# Assign values to variables a and b
a = 10 # Change this value
b = 20 # Change this value
# Print the values of a and b
print("The value of a is:", a)
print("The value of b is:", b)
```
### Part 2: Basic Arithmetic
Assign values to variables `x` and `y`. Perform addition, subtraction, multiplication, and division. Print the
results.
```python
# Part 2: Basic Arithmetic
# Assign values to variables x and y
x = 15 # Change this value
y = 5 # Change this value
# Perform arithmetic operations
addition = x + y
subtraction = x - y
multiplication = x * y
division = x / y
# Print the results
print("Addition:", addition)
print("Subtraction:", subtraction)
print("Multiplication:", multiplication)
print("Division:", division)
```
```python
# Part 3: Comparison Operations
# Assign values to variables m and n
m = 8 # Change this value
n = 12 # Change this value
# Perform comparison operations
print("m equals n:", m == n)
print("m not equals n:", m != n)
print("m greater than n:", m > n)
print("m less than n:", m < n)
print("m greater than or equals n:", m >= n)
print("m less than or equals n:", m <= n)
```
```python
# Part 4: Logical Operations
# Assign boolean values to variables p and q
Combine arithmetic and comparison operations. Assign values to variables `r` and `s`. Perform a
combined operation and print the result.
```python
# Part 5: Combined Operations
# Assign values to variables r and s