This Python program receives three inputs from the user:
- Two numbers: m and n
- A power value: r
It then calculates and displays the following expressions:
- a = mʳ − nʳ
- b = 2 × m × n
- c = mʳ + nʳ
# Receive inputs from user
m = float(input("Enter value for m: "))
n = float(input("Enter value for n: "))
r = int(input("Enter power r: "))
# Calculate expressions
a = m ** r - n ** r
b = 2 * m * n
c = m ** r + n ** r
# Display results
print("\n--- Result ---")
print(f"a = m^r - n^r = {a}")
print(f"b = 2 * m * n = {b}")
print(f"c = m^r + n^r = {c}")
Enter value for m: 3
Enter value for n: 2
Enter power r: 2
--- Result ---
a = m^r - n^r = 5.0
b = 2 * m * n = 12.0
c = m^r + n^r = 13.0
- The program receives three inputs: m, n, and r
- Exponentiation is performed using the ** operator
- Each expression is calculated using standard arithmetic and printed with clear labels