A Day at the Supermarket (1st tutorial)


hi, this is my first post on codeacademy. I seem to have run into some trouble with what should be straightforward; the first tutorial of 'A Day at the Supermarket'

The instructions were to print out all the names under the 'names' list using the for loop. here is what I typed up:

my code: for name in [names]:
print name

the error message says my code didn't print "Adam". But in the console, it's otherwise. Any advice?

Replace this line with your code.


Hi @devpro40656 ,

You have this loop header...

for name in [names]:

The variable, names, refers to a list. Since you placed it in square brackets, you are referring to a list within a list in the loop header. As a result, the program outputs the entire list as an item, with the name "Adam" being output as part of that list, instead of being output individually. This exercise intends for you to display each item individually. Revise the loop header accordingly.


I can see what you mean. Wow thanks for clearing that up. :slight_smile:


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