Exponentiation (Power of a Number)
Calculate the power of a number using operators and built-in functions.
- Read the base and exponent values from the user.
- Calculate the power using the
**operator orpow()function. - Display the result.
base = float(input("Enter base: "))
exp = float(input("Enter exponent: "))
result = base ** exp
print(f"{base} raised to {exp} is {result}")Enter base: 2
Enter exponent: 3
2.0 raised to 3.0 is 8.0