18 lines
405 B
Python
18 lines
405 B
Python
def main():
|
|
expression = input("Enter an arithmetic expression:\t\t")
|
|
x, y, z = expression.split()
|
|
result = 0.0
|
|
if y == '+':
|
|
result = int(x) + int(z)
|
|
elif y == '-':
|
|
result = int(x) - int(z)
|
|
elif y == '*':
|
|
result = int(x) * int(z)
|
|
elif y == '/':
|
|
result = int(x) / int(z)
|
|
print(round(float(result), 1))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|