def calculation(values):
x, y, z = values.split()
x = float(x)
z = float(z)
if y == "+":
return x+z
elif y == "-":
return x-z
elif y == "*":
return x*z
elif y == '/':
return x/z
values = input(“Enter mathematical values: “)
print(calculation(values))
I tried to put split(“”),split( ),split(” “) also putting a space for each variable ,I had expected that the arithmatic values would be assigned to x,z and y will hold the operator.But it is contuniousing showing the same error shown in the image.screenshot of the error
New contributor
BINU SHEJUTI DEY is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.