Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. import operator
  2.  
  3. ops = {"+" : operator.add,\
  4. "-" : operator.sub,\
  5. "*" : operator.mul,\
  6. "**" : operator.pow,\
  7. "/" : operator.truediv,\
  8. "//" : operator.floordiv}
  9.  
  10. print ("Введите первое значение")
  11. a = int(input())
  12. print ("Введите второе значение")
  13. b = int(input())
  14. print ("Введите одну из операций: + - * ** / //")
  15. op = input()
  16.  
  17. y = ops [op](a,b)
  18. print("")
  19. print("=",y)
  20. print("")
  21.  
  22. print("""Хотите продолжить работу с этой переменной/Выбрать новую/Выйти из программы?
  23.  
  24. Продолжить/Новая/Выйти
  25. """)
  26. answer1 = input()
  27.  
  28. while answer1 == ("Продолжить"):
  29. print("Введите одну из операций: + - * ** / //")
  30. op = input()
  31. print("Введите второе значение")
  32. b = int(input())
  33. y = ops [op](y,b)
  34. print("")
  35. print("=",y)
  36. print("""Хотите продолжить работу с этой переменной/Выбрать новую/Выйти из программы?
  37.  
  38. Продолжить/Новая/Выйти
  39. """)
  40. answer1 = input()
  41.  
  42. while answer1 == ("Новая"):
  43. print ("Введите первое значение")
  44. a = int(input())
  45. print ("Введите второе значение")
  46. b = int(input())
  47. print ("Введите одну из операций: + - * ** / //")
  48. op = input()
  49. y = ops [op](a,b)
  50. print("")
  51. print("=",y)
  52. print("")
  53. print("""Хотите продолжить работу с этой переменной/Выбрать новую/Выйти из программы?
  54.  
  55. Продолжить/Новая/Выйти
  56. """)
  57. answer1 = input()
  58.  
  59. while answer1 == ("Выйти"):
  60. print ("""
  61. До свидания""")
  62. quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement