Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. #1
  2. def program1():
  3. first = input("First Name: ")
  4. sur = input("Sur Name: ")
  5. for i in range(3):
  6. print(first, sur)
  7.  
  8. #2
  9. def program2():
  10. num1 = int(input("Num1 = "))
  11. num2 = int(input("Num2 = "))
  12. num3 = int(input("Num3 = "))
  13. result = (num1+num2) * num3
  14. print(num1, "+", num2, "", num3, "=", result)
  15. #3
  16. def program3():
  17. numdays = int(input("Number of days: "))
  18. numhrs = numdays * 24
  19. nummins = numhrs * 60
  20. numsecs = nummins * 60
  21. print(numhrs,nummins,numsecs)
  22. #4
  23. def program4():
  24. w = int(input("Width = "))
  25. l = int(input("Length = "))
  26. d = int(input("Depth = "))
  27. m3 = w * l * d
  28. print("The swimming pool has a volume of", m3, "cubic meter(s)")
  29. #5
  30. def program5():
  31. question = input("What is your question?\n")
  32. print("Let me think about that.. I don't want to answer that question right now")
  33. print(question)
  34. input()
  35. print("I thought so")
  36. #6
  37. def program6():
  38. hrswork = int(input("How many hours did you work?: "))
  39. payperhr = float(input("How much are you paid per hour?: "))
  40. payment = hrswork * payperhr
  41. print("you have earned",payment)
  42.  
  43. #7
  44. def program7():
  45. onepence = int(input("how many Pennys?: "))
  46. twopence = int(input("how many Two Pence?: "))
  47. fivepence = int(input("how many Five Pence?: "))
  48. tenpence = int(input("how many Ten Pence?: "))
  49. twentypence = int(input("how many Twenty Pence?: "))
  50. fiftypence = int(input("how many Fifty Pence?: "))
  51. onepound = int(input("how many Pounds?: "))
  52. twopound = int(input("how many Two Pounds?: "))
  53.  
  54. onepencecal = onepence * 0.01
  55. twopencecal = twopence * 0.02
  56. fivepencecal = fivepence * 0.05
  57. tenpencecal = tenpence * 0.10
  58. twentypencecal = twentypence * 0.20
  59. fiftypencecal = fiftypence * 0.50
  60. onepoundcal = onepound * 1
  61. twopoundcal = twopound * 2
  62.  
  63. totalpiggy = onepencecal + twopencecal + fivepencecal + tenpencecal + twentypencecal + fiftypencecal + onepoundcal + twopoundcal
  64.  
  65. print("Total Value of the piggy bank is",totalpiggy)
  66.  
  67. selection = input("Enter the question number of program you want to run? (1-7) ")
  68. if selection == ("1"):
  69. program1()
  70. if selection == ("2"):
  71. program2()
  72. if selection == ("3"):
  73. program3()
  74. if selection == ("4"):
  75. program4()
  76. if selection == ("5"):
  77. program5()
  78. if selection == ("6"):
  79. program6()
  80. if selection == ("7"):
  81. program7()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement