Advertisement
Guest User

Mortgage Calculator For Python

a guest
Aug 23rd, 2019
751
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. #beggining
  2. def start():
  3. start1 = True
  4.  
  5. start2 = input("Hello, and welcome to your Mortgage Calculator. Please Enter \"Start\" to start")
  6. if start2.upper() == "START":
  7. print("Starting...")
  8. else:
  9. print("You have not written \"Start\"")
  10. start1 = False
  11.  
  12. if start2.upper() == "START":
  13. print("Hello, in order to begin, we need to know the cost of each payment, wether the payment is monthly, weekly, or daily, and we need to know the interest rate")
  14.  
  15.  
  16. #questions
  17. Amount = float(input("How much of a loan have you taken?"))
  18. interest_rate = float(input("What is the interest rate on the loan? Please input the interest as a decimal. \n For example, a 3 percent interest rate would be written like 0.03"))
  19. payment_method = input("Is the payment monthly, yearly, or weekly?")
  20. if payment_method.lower() == "monthly":
  21. month = int(input("How many months do you have to play the loan off in?"))
  22. if payment_method.lower() == "yearly":
  23. year = int(input("How many Years do you have to play the loan off in?"))
  24. if payment_method.lower()== "weekly":
  25. week = int(input("How many months do you have to play the loan off in?"))
  26. else:
  27. print("Please check to make sure that you have written \"Monthly\", \"Yearly\", or \"Weekly\" correctly.")
  28.  
  29.  
  30.  
  31. interest_total = (Amount * interest_rate) + Amount
  32.  
  33. if payment_method.lower() == "monthly":
  34. a = interest_total / month
  35. print("You are going to have to pay {} per month".format(a))
  36. if payment_method.lower() == "yearly":
  37. b = interest_total / year
  38. print("You are going to have to pay {} per year".format(b))
  39. if payment_method.lower()== "weekly":
  40. c = interest_total / week
  41. print("You are going to have to pay {} per week".format(c))
  42.  
  43. def start2():
  44. Amount = float(input("How much of a loan have you taken?"))
  45. interest_rate = float(input("What is the interest rate on the loan? Please input the interest as a decimal. \n For example, a 3 percent interest rate would be written like 0.03"))
  46. payment_method = input("Is the payment monthly, yearly, or weekly?")
  47. if payment_method.lower() == "monthly":
  48. month = int(input("How many months do you have to play the loan off in?"))
  49. if payment_method.lower() == "yearly":
  50. year = int(input("How many Years do you have to play the loan off in?"))
  51. if payment_method.lower()== "weekly":
  52. week = int(input("How many months do you have to play the loan off in?"))
  53. else:
  54. print("Please check to make sure that you have written \"Monthly\", \"Yearly\", or \"Weekly\" correctly.")
  55.  
  56.  
  57.  
  58. interest_total = (Amount * interest_rate) + Amount
  59.  
  60. if payment_method.lower() == "monthly":
  61. a = interest_total / month
  62. print("You are going to have to pay {} per month".format(a))
  63. if payment_method.lower() == "yearly":
  64. b = interest_total / year
  65. print("You are going to have to pay {} per year".format(b))
  66. if payment_method.lower()== "weekly":
  67. c = interest_total / week
  68. print("You are going to have to pay {} per week".format(c))
  69.  
  70. def restart():
  71. restart = input("If you would like to restart, please type \"Start\"")
  72. if restart.upper() == "START":
  73. start2()
  74.  
  75. start()
  76. restart()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement