1234567891011121314151617 |
- 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()
|