FAQ: Errors in Python - Type Errors

This community-built FAQ covers the “Type Errors” exercise from the lesson “Errors in Python”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Analyze Financial Data with Python
Build Chatbots with Python
Build Python Web Apps with Flask

Learn Python 3

FAQs on the exercise Type Errors

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in #get-help.

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head to #get-help and #community:tips-and-resources. If you are wanting feedback or inspiration for a project, check out #project.

Looking for motivation to keep learning? Join our wider discussions in #community

Learn more about how to use this guide.

Found a bug? Report it online, or post in #community:Codecademy-Bug-Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

hello! <3

why would this correction not be considered a viable solution?

print(“The rectangle area is” + str(area) )


Has anyone figured this out?

Would also like to know why this isn’t accepted as a solution.

I think it would have more to do with style, as you are debugging some one else’s code that using their style to remain consistent is key. You’ll notice that it does print correctly.

Please let me know if I’m wrong though!

1 Like

It is a viable solution except Codecademy is very specific and narrow in the answer they want. A lot of these problems may have multiple solutions but they will mark them wrong if it’s not the exact one they’re looking for.

I did the same thing as you, the output terminal doesn’t say I have a TypeError but CodeAcademy won’t let me progress. Extremely frustrated right now.

I just reset my code, tried it again and for some reason it worked. I have no idea.

Hi, I just used the same style the coder used to print the area of the triangle and circle. So just change the ‘+’ to a ‘,’ and all went well.


Just put a comma. It looks like this:

print(“The triangle area is”, area)

Agreed - I wish they would build their tests to accept any valid solution, not just the exact one they’re looking for!

My main question is what sets " , " apart from " + "? Why do I need to make area a string when I use " + " but not a comma?

When you pass arguments of any type to print it effectively calls them with the str() function before outputting them as text. What you’re doing with the comma , is passing multiple arguments to the print function. Since each function is converted to text of some form before printing this is fine.

The + for the string type is concatenation that joins two strings into a new string. In that case the concatenation is performed first and then you’re passing a singular string object to print which is fine too.

Worth knowing both options exist and the differences between them.


i was writhing a whole big answer but mistakenly i just escaped and whole text got removed, sorry :frowning: