HI - I'm very new to computer programming and I cant even get through Problem set 1 by looking at the solution that is provided! why is it that when I enter minMonthlyPaymentRate it's gives me syntax error? i guess it makes sense cause it's not correct per say, but that's how they do it according to the solution. please help:)
you may be missing ' ' give me an example of what you have written
minMonthlyPaymentRate = float(raw_input("enter minimum monthly payment rate")
it's just giving a syntax error message for the left side of the equal sign
== the product is equal to. give this a try..how mine is written
You may also be missing a close bracket at the end of that line (note: brackets are also called parenthesis). The easiest way for us to figure out a problem you're having is to post all of the code here (make sure that the spacing is right!). It also helps to see the specific error python gave you.
##heres how i figured this out..very unorthodox and kinda cheating but it works:: x=float(raw_input('Outstanding balance:')) y=float(raw_input('Monthly interest rate:')) if x*y % 95.83: print 'Minimum monthly payment: 95.83' this is only what i did playing around with the idea..not really what should happen!!!!
original_balance = float(raw_input("Enter the outstanding balance on your credit card: ")) interest_rate = float(raw_input("Enter the annual credit card interest rate as a decimal: ")) balance = original_balance low_payment = balance/12 high_payment = (balance*(1+(interest_rate/12))**12)/12 while True: balance = original_balance monthly_payment = (low_payment + high_payment)/2 for month in range(1,13): interest = round(balance*interest_rate/12, 2) balance += interest - monthly_payment if balance <= 0: break if (high_payment - low_payment < 0.005): print "RESULT" monthly_payment = round(monthly_payment + 0.004999, 2) print "Monthly payment to pay off debt in 1 year:", round(monthly_payment,2) balance = original_balance for month in range(1,13): interest = round(balance*interest_rate/12, 2) balance += interest - monthly_payment if balance <= 0: break print "Number of months needed:", month print "Balance:", round(balance,2) break elif balance < 0: high_payment = monthly_payment else: low_payment = monthly_payment If completed correctly this is how the script should look.
please use a code pasting site - it makes it easier for everyone to refer to it (don't forget to enable syntax highlighting) http://dpaste.com http://pastebin.com (there are others) http://www.pythontutor.com/ is a good debugging tool
@Mal.bengt you are definitely missing a closing paren in that line you posted
Join our real-time social learning platform and learn together with your friends!