Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
I need some help with this piece of code!
month=0
debt=5,000
payment=100
interest=73.50
while month<12:
debt = payment
debt = interest
print debt
It is telling me that = is not valid.
What am I doing wrong.
 one year ago
 one year ago
I need some help with this piece of code! month=0 debt=5,000 payment=100 interest=73.50 while month<12: debt = payment debt = interest print debt It is telling me that = is not valid. What am I doing wrong.
 one year ago
 one year ago

This Question is Open

maskmethodBest ResponseYou've already chosen the best response.0
Read the error message the interpreter is giving you closely. The clue you need is in there.
 one year ago

rsmith6559Best ResponseYou've already chosen the best response.1
debt = 5,000 # wrong debt = 5000 # right
 one year ago

msmithhnovaBest ResponseYou've already chosen the best response.1
a la python shell you are creating a tuple and then trying to += (concatenate) an int to it >>> debt=5,000 >>> debt (5, 0) >>> debt+=100 Traceback (most recent call last): File "<pyshell#253>", line 1, in <module> debt+=100 TypeError: can only concatenate tuple (not "int") to tuple as rsmith said above, get rid of the ','
 one year ago

Gianko15Best ResponseYou've already chosen the best response.1
Don't forget that you never increase the value of month, your loop is endeless, never separate the numbers, only if they are floats. Remember also that, the interest are part of your payment, should be better if it looks like this: debt = debt  (payment+interest), that'll help if they ask you things like, total amount you paid.
 one year ago
See more questions >>>
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.