Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. import math
  2. what = input("Что хотите сделать?: ")
  3. x = float(input("Введите первое число: "))
  4. y = float(input("Введите второе число: "))
  5.  
  6. if what == "+":
  7. c = x + y
  8. print("Результат: " + str(c))
  9. elif what == "-":
  10. c = x - y
  11. print("Результат: " + str(c))
  12. elif what == "/":
  13. c = x / y
  14. print("Результат: " + str(c))
  15. if y == 0:
  16. print("Деление на 0!")
  17. elif what == "*":
  18. c = x * y
  19. print("Результат: " + str(c))
  20. elif what == "math.fmod":
  21. c = x % y
  22. print(str(c))
  23. elif what == "math.pow":
  24. c = x ** y
  25. print(str(c))
  26. else:
  27. print("Введена невозможная операция!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement