Lists Review Question

On this question I tried to do exactly what they asked, but it didn’t work, could someone please help me?

first_names = ['Ainsley', 'Ben', 'Chani','Depak']
age = []
age.append(42)
all_ages = []
all_ages.append([32, 41, 29]+age)
print(all_ages)

Hi!

Can you be more specific? What did they ask for specifically? What are you getting when you print(all_ages) (I’m asking in order for you to consider).

If you print all_ages, you’ll probably notice that it’s not a pure list. So if you say all_ages[3] it’s not going to work properly. This is going to be hard to pair with first_names as it is. (For example, first_names[3] would refer to 'Depak')

Therefore, consider reviewing this line and see how you can make it work more efficiently:

all_ages.append([32, 41, 29]+age)

That being said, I don’t know what the question to the exercise is (I don’t have pro). But I’m just thinking of useful formats for all_ages.

1 Like