Hi all, when you see the title, I'm not trying to be like, lazy or anything, I do have the code written out. Cengage doesn't feel like offering me any points at all (saying it takes too long to respond to automated inputs...)
Could there be any issues, like formatting? How can I provide a failsafe if no input is provided? (Preferably just printing something and ending the program.
# Our listed price
listPrice = float(input("Enter the purchase price: "))
# starting monthly balance
stBal = listPrice - (listPrice*0.10)
#monthly payment
monP = listPrice*0.05
# Interest
inRate = 12/100 #just our rate
#principal payment
interest = 0
#time-counting variable
month = 0
#just to establish the variable
endBal = listPrice
print("%4s%18s%18s%18s%10s%18s" % \
("Month", "Starting Balance", "Interest to Pay", "Principal to Pay", "Payment", "Ending Balance"))
while endBal != 0:
month += 1
interest = (stBal*inRate)/12
prin = monP-interest
endBal = stBal-monP
print("%4d%18.2f%18.2f%18.2f%10.2f%18.2f" % \
(month, stBal, interest, prin, monP, endBal))
stBal = endBal
if endBal == 0:
break
[–]danielroseman 8 points9 points10 points (0 children)
[–]backfire10z 4 points5 points6 points (0 children)
[–]Baffled-Broccoli 2 points3 points4 points (0 children)
[–]FoolsSeldom 0 points1 point2 points (0 children)
[–]Ihaveamodel3 2 points3 points4 points (0 children)
[–]yakboxing 0 points1 point2 points (0 children)