Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. print ("Hello.")
  2. print ("I am a calculator.")
  3. users_name = input("What might be your name? > ")
  4. print ()
  5. print ("A pleasure to meet you " + users_name + "!")
  6. command = input ("Would you like to add(+), subtract(-), multiply(x), or divide(/)? > ")
  7. print ()
  8. if command == "add" or command == "+":
  9. print ("Addition it is!")
  10. input1= input("1st number > ")
  11. input2= input("2nd number > ")
  12. number1 = int(input1)
  13. number2 = int(input2)
  14. result = number1 + number2
  15. answer = str(result)
  16. print (input1 + " + " + input2 + " = " + answer)
  17. print ("Impresive, I know")
  18. elif command == "subtract" or command == "-":
  19. print ("Subraction here we come!")
  20. input1= input("1st number > ")
  21. input2= input("2nd number > ")
  22. number1 = int(input1)
  23. number2 = int(input2)
  24. result = number1 - number2
  25. answer = str(result)
  26. print (input1 + " - " + input2 + " = " + answer)
  27. print ("Don't act like you're not impressed!")
  28. elif command == "multiply" or command == "x":
  29. print ("Multiplication is my favorite!")
  30. input1= input("1st number > ")
  31. input2= input("2nd number > ")
  32. number1 = int(input1)
  33. number2 = int(input2)
  34. result = number1 * number2
  35. answer = str(result)
  36. print (input1 + " x " + input2 + " = " + answer)
  37. print ("Sometimes I truly amaze myself!")
  38. elif command == "divide" or command == "/":
  39. print ("Ugh, division...")
  40. input1= input("1st number > ")
  41. input2= input("2nd number > ")
  42. number1 = int(input1)
  43. number2 = int(input2)
  44. result = number1 / number2
  45. answer = str(result)
  46. print (input1 + " / " + input2 + " = " + answer)
  47. print ("Yikes, I'm glad that's over with.")
  48. else:
  49. print ("That just doesn't make any sense. Please try your luck next time.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement