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

Below is code I wrote for calculating credit card interest, balances, etc. How do I correct my code to properly format for $ signs with 2 decimal points? Right now, my code is just printing numbers without the $ sign and more than two decimal points? Also, how do I correct my code so that the RESULT and Total Amount Paid and Remaining Balance print only once at the end of the run? Finally, the += and -=... is that just shorthand for adding and subtracting whatever is on the right side of that equation? balance = float(input('Enter the outstanding balance on your credit card: ')) ann_In

OpenStudy (e.mccormick):

ballance = 143.287592 print "$" + str(round(ballance,2))

OpenStudy (e.mccormick):

Just as an example, I set the ballance to something that would round.

OpenStudy (e.mccormick):

As for printing, run this code: http://dpaste.com/hold/1315094/

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!