Code viewer for World: Combining Operations
"""
Topic: Basic Arithmetic Operations – Combining Operations
Purpose: Understand how to combine different arithmetic operations in Python
Output: Displays results of multiple operations in one calculation
"""

# -----------------------------
# 1. Example numbers
# -----------------------------
a = 10
b = 5
c = 2

# -----------------------------
# 2. Combining addition, subtraction, multiplication, division
# -----------------------------
# Python follows the order of operations (PEMDAS/BODMAS)
# Parentheses (), Exponent **, Multiplication *, Division /, Floor Division //, Modulus %, Addition +, Subtraction -

result1 = a + b * c        # Multiplication happens first: 5 * 2 = 10, then 10 + 10 = 20
print(f"{a} + {b} * {c} = {result1}")

result2 = (a + b) * c      # Parentheses change order: (10 + 5) * 2 = 30
print(f"({a} + {b}) * {c} = {result2}")

result3 = a ** c + b        # Exponent first: 10 ** 2 = 100, then add 5 = 105
print(f"{a} ** {c} + {b} = {result3}")

result4 = a // c + b        # Floor division first: 10 // 2 = 5, then add 5 = 10
print(f"{a} // {c} + {b} = {result4}")

# -----------------------------
# 3. Notes
# -----------------------------
# 1. Python follows the order of operations automatically.
# 2. Use parentheses () to change the order of calculation.
# 3. You can combine any arithmetic operators in a single expression.
# 4. Using f-strings helps display both the calculation and the result clearly.