FAQ: Creating and Modifying a List in Python - Review


#1

This community-built FAQ covers the “Review” exercise from the lesson “Creating and Modifying a List in Python”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Computer Science
Data Science

FAQs on the exercise Review

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!


#2

Pint for clarification:
It isn’t clear in #4 from the words “Create a new list called all_ages that combines age with the following list:” means
age + [numbers]
and not [numbers] + age.
This apparently makes a difference as to where age is inserted.

all_ages = age + [32, 41, 29] #age goes to beginning
#all_ages = [32, 41, 29] + age #age goes to the end
print(age)
print(all_ages)


#3

This is important since if we print the zipped list items,

for x in name_and_age:
  print (x)

we want this…

('Ainsley', 42)
('Ben', 32)
('Chani', 41)
('Depak', 29)