Build an Employee Profile Generator - Step 9

Tell us what’s happening:

Error:
You should concatenate employee_age to the end of employee_info.

Code:

first_name = “John”
last_name = “Doe”
full_name = first_name + " " + last_name

address = “123 Main Street”
address += “, Apartment 4B”

employee_age = 28

employee_info = full_name + " is "
employee_info = employee_info + employee_age

Your code so far


# User Editable Region

first_name = "John"
last_name = "Doe"
full_name = first_name + " " + last_name

address = "123 Main Street"
address += ", Apartment 4B"

employee_age = 28

employee_info = full_name + " is "
employee_info = employee_info + employee_age

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36 Edg/145.0.0.0

Challenge Information:

Build an Employee Profile Generator - Step 9

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

I am trying to join (concatenate) the variable employee_age to the end of the string employee_info. However, employee_info is a string and employee_age is an integer (the number 28). When I run the code, Python throws a TypeError. It’s telling me it doesn’t know how to ‘add’ a number to a sentence automatically. Even though the instructions told me this error would happen, the ‘Check Your Code’ button isn’t letting me pass to the next step, where I learn how to fix it.

I’ve tried both employee_info = employee_info + employee_age and employee_info += employee_age, but I’m still stuck on this screen."

Welcome to the forum @violin1

Here is a comparison of the original code and your code.

The code in blue is the original code, the code in red is your code.
The code in magenta is the overlap.

You need to add the concatenation to the existing variable, do not assign to a new variable.

Happy coding

Now try to concatenate employee_age to the end of your employee_info string.

Concatenate to the existing employee_info string.

so like: employee_info += employee_age?

Nope. Just concatenate the age to the end of this string:

As you did here, concatenating last_name to the end of full_name, on the same line

1 Like

thank you! i tried your solution and it worked. I think the problem was that I did not put everything into one line.

1 Like

Thank you! This helped me understand how this challenge works.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.