"""
Topic: Combining Operations: Physics Example
Purpose: Explore how to use Python to calculate using a physics formula
Output: Calculates displacement using the equation s = ut + 1/2 at²
"""
# -----------------------------
# 1. Variables in the formula
# -----------------------------
# u = initial velocity (m/s)
# t = time (s)
# a = acceleration (m/s²)
u = 5 # initial velocity in meters/second
t = 10 # time in seconds
a = 2 # acceleration in meters/second²
# -----------------------------
# 2. Calculating displacement
# -----------------------------
# Using the formula: s = u*t + 1/2 * a * t²
s = u * t + 0.5 * a * t ** 2 # multiplication, exponent, and addition combined (1/2 is 0.5)
# -----------------------------
# 3. Displaying the result
# -----------------------------
print(f"Initial velocity (u) = {u} m/s")
print(f"Time (t) = {t} s")
print(f"Acceleration (a) = {a} m/s²")
print(f"Displacement (s) = {s} meters")
# -----------------------------
# 4. Notes
# -----------------------------
# 1. Python follows order of operations automatically.
# 2. Exponent ** has higher priority than multiplication * and addition +.
# 3. Using f-strings makes the output clear and readable.