-  [WT]  [PS]  [Home] [Manage]

[Return]
Posting mode: Reply
  1.   (reply to 5119)
  2. (for post and file deletion)
/pr/ - Programming
  • Supported file types are: C, CSS, DOC, DOCX, GIF, H, JAVA, JPG, PDF, PNG, SVG, SWF, TXT, WEBM
  • Maximum file size allowed is 10000 KB.
  • Images greater than 200x200 pixels will be thumbnailed.
  • Currently 404 unique user posts. View catalog

  • Blotter updated: 2011-01-12 Show/Hide Show All

There's a new /777/ up, it's /gardening/ Check it out. Suggest new /777/s here.

Movies & TV 24/7 via Channel7: Web Player, .m3u file. Music via Radio7: Web Player, .m3u file.

WebM is now available sitewide! Please check this thread for more info.

MIT/ HW anon 18/06/19(Tue)04:48 No. 5119
5119

File MIT6_0001F16_ps1.pdf - (673.41KB )

im trying to do the first part of the problem and i wrote it in python, but im getting the wrong outcome.......


annual_salary = float(input("enter your annual salary: " ))
portion_saved = float(input("enter your portion of salary your going to save: "))
total_cost = float(input("enter cost of dream house: "))
r = 0.04
months = 0
i = 0
down_payment = total_cost*0.25
savings = (annual_salary /12) * portion_saved
current_savings = 0.0
#print("annual salary: " +str(annual_salary))
#i=0
while (current_savings <= down_payment):
current_savings = savings + current_savings
months = months + 1
if(months >= 2):
returning = savings * r
current_savings = current_savings + returning

if (current_savings >= down_payment):
print("Number of months: " + str(months))




Delete post []
Password  
Report post
Reason