Hey now! No using array indexing for this one


#1

Project: A DAY AT THE SUPERMARKET
BeFOR We Begin

What is the difference between my code failing with the error message: Hey now! No using array indexing for this one and the Codecademy source code that is simply using a different variable name in the for loop? Is it just a bug maybe? I get the same console output for both but don’t understand what it means by array indexing.

MY CODE
names = [“Adam”,“Alex”,“Mariah”,“Martine”,“Columbus”]

for var1 in names:
print var1

CODECADEMY CODE
names = [“Adam”,“Alex”,“Mariah”,“Martine”,“Columbus”]

for name in names:
print name


#2

i think using a different variable is no problems as long as this variable name doesn’t contain numbers


#3

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