Stuck on Section 05 09

Hi all,

I’ve hit a road block on Section 05 09. Naming error?

I’m using the same code as in the tutorial but getting an error when running.

I’ve tried moving to the next tuts, but that "prices.append(item[1]) " “NameError: name ‘item’ is not defined” keeps coming up.

I’ve gone over this again and again, and can’t figure it out.

Any advice would be appreciated:

Class Code:

items = [
(“Product1”, 10),
(“Product2”, 9),
(“Product3”, 12),
]

prices =
for items in items:
prices.append(item[1])

print(prices)

My Code:

items = [
(“Product1”, 10),
(“Product2”, 9),
(“Product3”, 12),
]

prices =
for items in items:
prices.append(item[1]) *** Error line ***

print(prices)

Error:

app.py", line 9, in
prices.append(item[1])
NameError: name ‘item’ is not defined

1 Like

Vscode, PyCharm and Terminal giving same error.

Using Python 3

Hi,

try with this code:

items = [
(“Product1”, 10),
(“Product2”, 9),
(“Product3”, 12),
]

prices =
for item in items:
prices.append(item[1])

print(prices)

Br

Ah ok
“for item in items:” instead of
“for itemS in items:”

Got it,

Thank you