hi i'm getting a syntax error on a simple print statement and cant figure out why can any one help?
paste your piece of code here so we can help you :)
paste your printf statement here which is giving error so that we can help you out.
##gather user input balance = float(raw_input('Outstanding Balance:')) intrest_rate_pa = float(raw_input('Annual Intrest Rate as a Decimal:')) min_monthly_payment_rate = float(raw_input('Minimum monthly payment rate as a Decimal:')) ##print str(balance) ##print str(intrest_rate_pa) ##print str(min_monthly_payment_rate) ##define varaibles min_month_payment = 0 intrest_paid = 0 principle_paid = 0 remaining_balance = 0 month = 0 x = 0 for month in range(1,12): x += min_month_payment month += 1 min_month_payment = min_monthly_payment_rate * balance intrest_paid = intrest_rate_pa / 12 * balance principal_paid = min_month_payment - intrest_paid remaining_balance = balance - principal_paid print "RESULTS" print str(month) print 'Principal paid:' + '$' + str(round(principal_paid, 2)) print 'Minimum montthly payment' + '$' + str((round(min_month_payment,2)) print 'Remaining Balance' + '$' + str(round(remaining_balance, 2)) ## this line gives a syntax error balance = remaining_balance if month == 12: print 'Total Paid:' + '$' + str(round(x, 2)) print 'Remaining Balance:' + '$' + str(round(remaining_balance,2))
ok You didnt have to post the whole code:P but since you did: - 1st What i see is a very compicated and long code.Think in a more simple way. -2nd You dont need to inicialize the balance intrest_rate_pa min_monthly_payment_rate variables, as the problem says you dont have to do it since their tester is doing that for you.(will give you error if you send it like this). -3rd Review your for loop and review the for iteration rules in general. -4th "print 'Minimum montthly payment' + '$' + str((round(min_month_payment,2))" You have a parenthesis more than needed.Maybe this is what gives you the syntax error? -5th I'd use the parenthesis with print always to be sure. -->print('blabla') -6th The main variables you have defined are different from the ones they ask in the problem so this will probably give you an error when sending the answer. -7th And do what you are asked to do ,nothing extra, as it will probably give you error message when you send the problem for checking. Hope i didnt sound too harsh! :) Gl with your try and ask for further help if you need it. P.S. Don't post answers before the Problem Set is due (monday) as it is not right and not permitted. :) Post pieces of the code you experience a problem with .
thanks for the reply it totally was that extra parenthesis, im not actually on the program I'm just following the syllabus at my own pace for fun
ah ok then i suppose u can write it as complicated and garned as u like:P Good Luck again!:)
Join our real-time social learning platform and learn together with your friends!