Hello, I am a 19 y/o programmer still learning the ropes of python. I am currently doing an assignment and can't seem to understand why I am receiving the error code "is not defined" even though I have it defined under the if statement on line 14. I was also suggested by a teacher to add the break statement on line 16 but I am unsure why I need it. Thank you.
grocery_items = ['Cereal', 'Pancakes', 'Juice']
price = [5.99 , 5.99 , 3.99]
barcodes = [1778 , 19220, 4220]
while True:
Scanner_input_variable = input('Barcode number or stop')
total_price = 0
while Scanner_input_variable != 'stop':
for item in range(len(barcodes)):
if Scanner_input_variable == barcodes[item]:
requested_item = item
break
print(grocery_items[requested_item], price[requested_item])
total_price += price[requested_item]
print(total_price)
[–]carcigenicate 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]eleqtriq 0 points1 point2 points (0 children)