Advertisement
suewalters

Calculations

Apr 22nd, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. print("Hi, I am a Math Whiz.")
  2. users_name=input("What is your name? ")
  3. print("Hi "+users_name+" Let's do some Math")
  4. print("Let's add three numbers together.")
  5. input1=input("Number 1> ")
  6. input2=input("Number 2> ")
  7. input3=input("Number 3> ")
  8. number1=int(input1)
  9. number2=int(input2)
  10. number3=int(input3)
  11. result=number1+number2+number3
  12. output=str(result)
  13. print(input1+"+"+input2+"+"+input3+"="+output)
  14. print("Good job "+users_name)
  15. print("Now let's do a subtraction problem.")
  16. input1=input("Number 1> ")
  17. input2=input("Number 2> ")
  18. number1=int(input1)
  19. number2=int(input2)
  20. result=number1-number2
  21. output=str(result)
  22. print(input1+"-"+input2+"="+output)
  23. print("Good job "+users_name)
  24. print("Now let's calculate the area of a square.")
  25. input1=input("Please enter the length of one side of the square> ")
  26. number1=int(input1)
  27. result=number1*number1
  28. output=str(result)
  29. print("The area of the square = "+output)
  30. print("Good job "+users_name)
  31. print("Now let's calculate the sale price of an item.")
  32. input1=input("What is the original price of the item?> ")
  33. input2=input("What is the percentage discount on the item?> ")
  34. number1=int(input1)
  35. number2=int(input2)
  36. discount=number1*(number2/100)
  37. result=number1-discount
  38. prtdiscount=str(discount)
  39. output=str(result)
  40. print("The amount you will save on this item is "+prtdiscount)
  41. print("Your final price for this item is "+input1+"-"+prtdiscount+"="+output)
  42. print("Good job "+users_name)
  43. print("Have a nice day. Good Bye")
  44.  
  45.  
  46. Hi, I am a Math Whiz.
  47. What is your name? Sue
  48. Hi Sue Let's do some Math
  49. Let's add three numbers together.
  50. Number 1> 1
  51. Number 2> 2
  52. Number 3> 3
  53. 1+2+3=6
  54. Good job Sue
  55. Now let's do a subtraction problem.
  56. Number 1> 90
  57. Number 2> 5
  58. 90-5=85
  59. Good job Sue
  60. Now let's calculate the area of a square.
  61. Please enter the length of one side of the square> 7
  62. The area of the square = 49
  63. Good job Sue
  64. Now let's calculate the sale price of an item.
  65. What is the original price of the item?> 100
  66. What is the percentage discount on the item?> 10
  67. The amount you will save on this item is 10.0
  68. Your final price for this item is 100-10.0=90.0
  69. Good job Sue
  70. Have a nice day. Good Bye
  71. >>> Sue
  72.  
  73. ---------- FINISHED ----------
  74. exit code: 2 status: 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement