Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 19 Online
OpenStudy (anonymous):

'bal=float(raw_input("what is your credit card balance?") ans=float(raw_input("And you annual interest rate?") mpr=float(raw_input("How about your minimum monthly payment rate?") month=0 while (month<12): mpr*bal=mmp (ans/12)*bal=ipm mmp-ipm=ppm bal-ppm=rmb print(month) print("your minimum monthly payment is", mmp) print("Your remaining balance is", rmb) print("Your principal paid this month is", ppm)' problem set 1 help please?

OpenStudy (anonymous):

This is my code beginning. idk whats wrong i feel like I'm giving it the right instructions but i know its my error not the computers ):

OpenStudy (bibby):

for one, I'm pretty sure you want the variables getting assigned things to be on the left of the = assignment

OpenStudy (bibby):

what you're doing is 5=x instead of x=5

OpenStudy (anonymous):

Im confused. its reading me a syntax error and highlighting the second variable listed here as 'ans'. 'ans' is the variable i want and i want it equal to whatever the user inputs for their annual interest rate. I see that further down i put the variable on the right, thank you for that insight as it would have went unnoticed. But I'm not sure where the error is in the second line.

OpenStudy (bibby):

I don't know python so I can't address syntax. instead of ``` mpr*bal=mmp (ans/12)*bal=ipm mmp-ipm=ppm bal-ppm=rmb ``` try ``` mmp=mpr*bal ipm= (ans/12)*bal ppm=mmp-ipm rmb=bal-ppm ```

OpenStudy (woodrow73):

Just a hunch.. maybe you need to use single quotes instead of double quotes after raw_input.. though I'm really unsure- I don't know much of python.

OpenStudy (anonymous):

I just figured it out. in the first three lines i didn't close with two end parentheses i only use one so it was catching it up. thanks for the help guys

OpenStudy (anonymous):

bal=float(raw_input("what is your credit card balance?")) air=float(raw_input("And you annual interest rate?")) mpr=float(raw_input("How about your minimum monthly payment rate?")) month=1 while (month<13): mmp=mpr*bal ipm=(air/12)*bal ppm=mmp-ipm rmb=bal-ppm print('month' month) print("your minimum monthly payment is" mmp) print("Your remaining balance is" rmb) print("Your principal paid this month is" ppm) month+= 1 This is my final code and there is a problem with the loop. It loops back the 12 months like i want but it gives me the same statistics for every month so I'm under the impression that i need to add another increment change but I'm not certain what exactly

OpenStudy (woodrow73):

Maybe update the balance to equal rmb at the end of each loop (iteration)?

OpenStudy (anonymous):

i did, and my script is up and running thanks again. it really helps when you're teaching yourself to have other people to consult with.

OpenStudy (woodrow73):

that's for sure :) it's cool that I can help even if I don't know python. -java student

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!