FAQ: Exploring Data with Python - Lists

This community-built FAQ covers the “Lists” exercise from the lesson “Exploring Data with Python”.

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

[Beta] Getting Started with Python for Data Science

FAQs on the exercise Lists

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

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

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in #get-help.

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

Need broader help or resources? Head to #get-help and #community:tips-and-resources. If you are wanting feedback or inspiration for a project, check out #project.

Looking for motivation to keep learning? Join our wider discussions in #community

Learn more about how to use this guide.

Found a bug? Report it online, or post in #community:Codecademy-Bug-Reporting

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!

Why would someone need to modify an entry with

product_categories[1] = ‘desktops’

instead of just altering the string in the list variable?

I can understand the confusion with this beta thing. The instructions and examples on the left side don’t match with what one is asked to do in the jupyter notebook on the right side. Why one would import pandas as pd and then pandas commands as list items is beyond me. :thinking:
It’s weird. But, I digress.

With this specific example, you’re updating that particular index item in the list, product_categories = ['laptops','desktop computers','tablets']

product_categories[1] = ‘desktops’

so it will be,
product_categories = ['laptops','desktops','tablets']

I think I just really didn’t understand why this is needed when you can just amend the item yourself in the original list - but this makes sense. Thank you :slight_smile:

1 Like

I should have added, it’s really just a shorthand way of updating items in a list, rather than updating the original list itself every time.

yeah i can understand it’s probably easier especially if you’re dealing with huge lists of data.

thanks for your help

1 Like