Q:

How do I fix this code to get the proper output

This is the code:
amount_borrowed = float(input("Amount borrowed: $"))
interest_rate = float(input("Interest rate: "))
loan_length = int(input("Length of loan (months): "))
i = interest_rate/100
monthly_payment1 = (i / 12) * amount_borrowed    #this is the first part of the payment formula

monthly_payment2 = monthly_payment1 / 1 - (1 + i / 12)**-loan_length          
#second part of monthly payment formula

print("The monthly payment is ${:.2f}" .format(monthly_payment2))

I should get this output:
Amount borrowed: $100.00
Interest rate: 10.0
Length of loan (months): 12
The monthly payment is $8.79.
I keep on getting this:
Amount borrowed: $100
Interest rate: 10
Length of loan (months): 12
The monthly payment is $-0.07

A:

Don't make much sense divide by 1. I think that you did forget a pair of parentheses in the denominator of the division. So, the following line
monthly_payment2 = monthly_payment1 / 1 - (1 + i / 12)**-loan_length

should be
monthly_payment2 = monthly_payment1 / (1 - (1 + i / 12)**-loan_length)

I tested here and get the expect value of $8.79

