(SOLVED)List exercise with Maria's shop | Learn Python 3

In Learn Python 3 class excercise, I would like to do a 2D list for Maria’s shop. So I write below code, below it keeps showing Error message " File “script.py”, line 8
print(customer_data)
^
SyntaxError: invalid syntax"

I couldn’t figure out why… could anyone help me out?
INSTRUCTION: Create a two-dimensional list called customer_data using the following table as a reference for the data. Each sublist should contain a name, size, and expedited shipping option for a single person.
螢幕快照 2022-10-02 下午3.01.15

My code:

first_names = ["Ainsley", "Ben", "Chani", "Depak"] preferred_size = ["Small", "Large", "Medium"] preferred_size.append("Medium") print(preferred_size) customer_data = [[first_names[0], preferred_size[0], True], [first_names[1], preferred_size[1], False], [[first_names[2], preferred_size[2], True], [first_names[3], preferred_size[3], False]] print(customer_data)

first_names = [“Ainsley”, “Ben”, “Chani”, “Depak”]

preferred_size = [“Small”, “Large”, “Medium”]

preferred_size.append(“Medium”)

print(preferred_size)

customer_data = [[first_names[0], preferred_size[0], True], [first_names[1], preferred_size[1], False], [[first_names[2], preferred_size[2], True], [first_names[3], preferred_size[3], False]]

print(customer_data)

Hi,
Your error is on the line above the one highlighted.


You’ve an extra [ just before first_names[2]

Hope that helps

1 Like

THANK YOUUUUU!!! :rofl: Now I feel so silly, but also feel happy it’s not logically error.

1 Like