Trying to add a word with a number and another word

Hello, community!

I am super new (started an hour ago) and I am testing out this forum to see what kind of help I can expect when starting off. I am trying to print a message that says “Dalton is 27 years old” by adding a variant and an integer together. I know the easy way to do this would be to just create a variant that says all of that and then print it but I want to understand why it is not working this way.

Can someone help me understand why this isn’t working and what I need to do to fix it?

https://www.codecademy.com/workspaces/62881059b4f734adfeafcaea

Hey Dalton,
It seems you have a type error when your program attempts to run, this is occurring because you are trying to print a variable that is storing a integer value as opposed to a string. Instead try using the function str() to convert the integer value into a string, like this:

message = name + “is” + str(age) + “years old”

I hope this helps, and good luck with your future coding endeavors.

1 Like

Thank you so much, @sebwoe! Believe it or not, I thought I had already tried that! I must have done it some other way. I appreciate you offering your support and guidance :slight_smile:

1 Like