Hello,
Just a quick question that isn’t necessarily part of the exercise but should be simple to answer.
This is the link to the exercise i’m on but I’m trying to do a little extra.
first_names = ['Ainsley', 'Ben', 'Chani', 'Depak']
age = []
age.append(42)
all_ages = [32, 41, 29] + age
name_and_age = zip(first_names, all_ages)
print(list(name_and_age))
ids = range(4)
print(list(ids))
name_age_id = zip(name_and_age, ids)
print(list(name_age_id))
My issue lies at the bottom of the code. I was attempting to create a new variable, name_age_ids
to combine ids
with the list of name_and_age
. However, when I run this, I end up with an just an empty bracket for the last print()
I actually just solved the problem by doing name_age_id = zip(first_names, all_ages, ids
instead.
However, I am still posting this because I would like some insight if the original way I attempted it is possible, and if so what was I doing incorrectly?