Hey codecademy, I just started the new Intermediate Python3 course and noticed something I would like some clarification for regarding syntax. Does it matter if the third argument(s) passed to the dictionary are one comma-separated string or multiple comma-separated strings. I initially overlooked that your argument (line 5) for ‘order_items’ (‘Orange Juice, Apple Juice’) is one string, so when I inout my data I provided ‘order_items’ as (‘Steak’, ‘Seabass’, ‘Wine Bottle’)), or 3 separate comma-separated strings. My code ran without errors. I also input the order_items as (‘Steak, Seabass, Wine Bottle’)) and got the same result. Are both syntax acceptable? and why? Thanks.
tables = {
1: {
‘name’: ‘Jiho’,
‘vip_status’: False,
‘order’: ‘Orange Juice, Apple Juice’ //Codecademy provided a single comma separated string
},
2: {},
3: {},
4: {},
5: {},
6: {},
7: {},
}
print(tables)
def assign_table(table_number, name, vip_status=False):
tables[table_number][‘name’] = name
tables[table_number][‘vip_status’] = vip_status
tables[table_number][‘order’] = ‘’
Write your code below:
def assign_and_print_order(table_number, *order_items):
tables[table_number][‘order’] = order_items
for item in order_items:
return order_items[:]
assign_table(2, ‘Arwa’, True)
print()
assign_and_print_order(2, ‘Steak’, ‘Seabass’, ‘Wine Bottle’) //I passed 3 comma-separated strings
print(tables)
assign_table(3, ‘Mizzy’, True)
print()
assign_and_print_order(3, ‘Scallops’, ‘Asparagus’, ‘3 Wine Bottles’) //Again, I passed 3 comma-separated strings
print(tables)