I'm trying to work on problem set 1, part 1 but I'm kind of stuck. Here's a piece of the code I'm trying to run and the results hopefully someone can advise. I'm using python 3.3.5 so some stuff won't be as in the class. I just need help to get the while loop working.
It is working. Look at it this way: month = 0 Borrowed=float(input('How much have you borrowed: ')) How much have you borrowed: 500 Paid=float(input('How much you pay every month:')) How much you pay every month:100 while month < 5: month += 1 balance = Borrowed - Paid (balance = 500 - 400) print ('Month:',month) Month: 1 print ('balance:',balance) balance: 400.0 month += 1 balance = Borrowed - Paid (balance = 500 - 400) print ('Month:',month) Month: 2 print ('balance:',balance) balance: 400.0 And so on. Every time it loops, you set it to 400 then print it. If you need Borrowed later, then before the loop set `balance = Borrowed`. Then in the loop do `balance = balance - Paid`
Join our real-time social learning platform and learn together with your friends!