Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. import math
  2. from math import pi , e
  3.  
  4.  
  5. def schet(string):
  6.     if (string == "pi"):
  7.         return pi
  8.     elif (string == "e"):
  9.         return e
  10.     else:
  11.         return float(string)
  12.  
  13. print ("Первое число")
  14. x = schet(input())
  15.  
  16. print ("Операция")
  17. a = input()
  18.  
  19. print ("Следующее число")
  20. y = schet(input())
  21.  
  22. if (a == '*'):
  23.     itog = x*y
  24. elif (a == '/'):
  25.     itog = x/y
  26. elif (a == '+'):
  27.     itog = x+y
  28. elif (a == '-'):
  29.     itog = x-y
  30. elif (a == '%'):
  31.     itog = x % y
  32. elif (a == '^'):
  33.     itog = x**y
  34. print(itog)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement