0

I am new programming in Python. I am trying to create a function that simply takes the lowest payment (which starts at 10) and it simply returns the remaining balance (after 12 months of payments).

- Outside the function I am using a loop that calls the function and checks if the remaining balance is zero or less than zero. If it is not, increment the lowest payment +$10 and call the function again. When remaining balance is zero or less than zero print out the lowest payment.

In theory the output should be as follows :

```
***Test Case 1:***
balance = 3329
annualInterestRate = 0.2
Result Your Code Should Generate:
-------------------
******Lowest Payment: 310******
***Test Case 2:***
balance = 4773
annualInterestRate = 0.2
Result Your Code Should Generate:
-------------------
**Lowest Payment: 440**
***Test Case 3:***
balance = 3926
annualInterestRate = 0.2
Result Your Code Should Generate:
-------------------
**Lowest Payment: 360**
```

So far, this is what I have :

```
balance = 100
annualInterestRate = 0.2
per_month = ( annualInterestRate / 12 )
convert_to_str = str(per_month)[:4]
per_month = float(convert_to_str)
lowest_payment = 0
def main():
i = 0
while i < 11:
global balance
global lowest_payment
global per_month
balance = balance - lowest_payment
balance = ((balance * per_month) + balance)
i = i +1
#print (balance)
main()
if balance <= 0 or balance == 0:
print "Lowest Payemnt: " + str(lowest_payment)
else:
lowest_payment = lowest_payment + 10
main()
```

The problem is that is is not executing my function, and go over the loop again.

Your help is greatly appreciated.

*Edited 3 Years Ago by pyTony*: Format fix