-  [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 427 unique user posts. View catalog

  • Blotter updated: 2018-08-24 Show/Hide Show All

We are in the process of fixing long-standing bugs with the thread reader. This will probably cause more bugs for a short period of time. Buckle up.

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))


>>
Steve Jobs 18/09/23(Sun)21:17 No. 5138

>>5119
What version of python are you running?





Delete post []
Password  
Report post
Reason