by CodeChum Admin
You have been cordially invited to partake in Operation: Operation. Your mission, should you choose to accept it, is to take the two numbers and the operator given then perform the operation successfully.
Instructions:
Instructions
Input
The first line contains the first number.
The second line contains the operator.
The third line contains the second number.
5
+
0.70
Output
A line containing a decimal/float containing two decimal places.
5.70
x, operator, y = float(input()), input(), float(input())
if operator == '+':
print(round(x + y, 2))
elif operator == '-':
print(round(x - y, 2))
elif operator == '*':
print(round(x * y, 2))
elif operator == '/' and y != 0:
print(round(x / y, 2))
else:
print('Wrong input!')
Comments
Leave a comment