Build an Employee Profile Generator - Step 16 in:title employee code

I don’t know what I’m doing wrong here.

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 ' + str(employee_age) + ' years old'
print(employee_info)
years_experience = 5
experience_years = 5
experience_info = 'Experience: ' + str(experience_years) + ' years'
print(experience_info)
position = 'Data Analyst'
salary = 75000
employee_card = f'Employee: {full_name} | Age: {employee_age} | Position: {position} | Salary: ${salary}'
print(employee_card)
employee_code = 'DEV-2026-JD-001'
department = employee_code[0,3]
print (department)

You should have a variable named employee_code.

I have a variable named the above. I even copied and pasted the name. What am I doing wrong here?

I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add the backticks.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

Welcome to the forum @USMC1071 !

You should be seeing an error in the console:

Traceback (most recent call last):
  File "main.py", line 18, in <module>
TypeError: string indices must be integers, not 'tuple'

Please compare your slice syntax to the example provided in this step’s instructions.

Happy coding!

Thank. you all for your help! I appreciate it

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