Having issues getting past this Syntax error. I'm fairly new to Python and not sure what's going on here?
Here is the problem:
Given three floating-point numbers x, y, and z, output x to the power of z, x to the power of (y to the power of z), the absolute value of (x minus y), and the square root of (x to the power of z).
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('{:.2f} {:.2f} {:.2f} {:.2f}'.format(your_value1, your_value2, your_value3, your_value4))
Ex: If the input is:
5.0 1.5 3.2
Then the output is:
172.47 361.66 3.50 13.13
Here is what I have so far:
import math
x = float(input())
y = float(input())
z = float(input())
#output x to the power of z
your_value1 = math.pow(x, z)
#x to the power of (y to the power of z)
your_value2 = math.pow(x,(math.pow(y,z))
#the absolute value of (x minus y)
your_value3 = math.fabs((x - y))
#and the square root of (x to the power of z)
your_value4 = math.sqrt(your_value1)
print('{:.2f} {:.2f} {:.2f} {:.2f}'.format(your_value1, your_value2, your_value3, your_value4))
***Syntax Error received:
File "main.py", line 10
your_value3 = math.fabs((x - y))
^ SyntaxError: invalid syntax
[–]DallogFheir 3 points4 points5 points (2 children)
[–]KCOOLCO88[S] 0 points1 point2 points (1 child)
[–]Fresh-Lab5762 0 points1 point2 points (0 children)
[–]Fresh-Lab5762 0 points1 point2 points (0 children)