# Problem Set 1b # Name: Steph # Collaborators: # Time Spent: 30min outstandingBalance = float(raw_input('Enter the outstanding balance on your credit card: ')) interestRate = float(raw_input('Enter the annual credit card interest rate as a decimal: ')) monthlyInterestRate = interestRate / 12 balance = outstandingBalance payment = 0 while balance > 0: balance = outstandingBalance payment = payment + 10 for i in range(12): balance = round(balance*(1+monthlyInterestRate),2) - payment if balance < 0: break print('Monthly payment to pay off debt in 1 year:' + str(payment)) print('Number of months needed: ' + str(i+1)) print('Balance:' + str(balance))
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question