Advertisement
sanezek

Untitled

Jul 29th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. print("Hello, my name is calculator! And what about you? ")
  2. name = input( "My name is: ")
  3. name1 = "Andrew"
  4. if name != name1:
  5. print('Error')
  6. exit(0)
  7. what = input( "what we doing? (+,-,*,/,**,%,//): " )
  8. a = float( input( "Write first number: ") )
  9. b = float( input( "Write second number: ") )
  10. c = None
  11.  
  12. if what == "+":
  13. c = a + b
  14. elif what == "-":
  15. c = a - b
  16. elif what == "*":
  17. c = a * b
  18. elif what == "/":
  19. c = a / b
  20. elif what == "**":
  21. c = a ** b
  22. elif what == "%":
  23. c = a % b
  24. elif what == "//":
  25. c = a // b
  26.  
  27. if c:
  28. print("equals: ",c)
  29. else:
  30. print("Invalid action")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement