Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please help with the code
#5
Ok so I have changed my code a bit but is still printing now -139 months which is wrong.


initial_balance = 1000
rate = 10
withdraw = 500
result = 1
target = result
balance = initial_balance
month = 1

while balance>result:
    interest = balance*rate/100
    balance = balance - interest - withdraw
    month = month-interest
    
if balance == month:
    print (month)

print ("no of months is", month)
Reply


Messages In This Thread
Please help with the code - by zarnav - Feb-12-2017, 02:15 PM
RE: Please help with the code - by wavic - Feb-12-2017, 02:17 PM
RE: Please help with the code - by zarnav - Feb-12-2017, 02:20 PM
RE: Please help with the code - by wavic - Feb-12-2017, 02:37 PM
RE: Please help with the code - by zarnav - Feb-12-2017, 04:32 PM
RE: Please help with the code - by ichabod801 - Feb-12-2017, 07:11 PM
RE: Please help with the code - by sparkz_alot - Feb-13-2017, 03:09 PM
RE: Please help with the code - by wavic - Feb-13-2017, 03:45 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020