A community for students.
Here's the question you clicked on:
 0 viewing
anonymous
 3 years ago
I am getting a type error
'cannot concatonate 'str' and int objects' for
balance = 5000
print 'Month 1 Balance = ' + balance
Any tips ?
anonymous
 3 years ago
I am getting a type error 'cannot concatonate 'str' and int objects' for balance = 5000 print 'Month 1 Balance = ' + balance Any tips ?

This Question is Closed

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0You'll need to convert your int to a String before you print it as part of another String. What language are you using?

anonymous
 3 years ago
Best ResponseYou've already chosen the best response.0Ok. Im not really familiar with Python but try using the str() function. Try : print 'Month 1 Balance = ' + str(balance)

pdpinch
 3 years ago
Best ResponseYou've already chosen the best response.1Daire is right, but another common solution is to use a comma instead of the + print 'Month 1 Balance =', balance
Ask your own question
Sign UpFind more explanations on OpenStudy
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.