-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmay29exercise.py
33 lines (30 loc) · 1.31 KB
/
may29exercise.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
seating_chart = [
[None, "Pumpkin", None, None],
["Socks", None, "Mimi", None], # changed nil to none
["Gismo", "Shadow", None, None],
["Smokey","Toast","Pacha","Mau"]
]
# Display the list of available seats to your user
for i, row in enumerate(seating_chart, start=1):
for n, seat in enumerate(row, start=1):
if seat == None:
print(f'Row {i} seat {n} is free.')
# For each available seat, use input() to prompt your user to choose whether they want to claim that spot.
# If they indicate they want to claim a seat, prompt them for their name and insert it into the array to show that they've been seated, like so:
def seat_picker():
for i, row in enumerate(seating_chart, start=1):
for n, seat in enumerate(row, start=1):
if seat == None:
print(f'Row {i} seat {n} is free. Do you want to sit there? (y/n)')
decision = input()
if decision == 'y':
print('What is your name?')
name = input()
del seating_chart[i-1][n-1]
seating_chart[i-1].insert(n-1, name)
print(f'Please take your seat in row {i} seat {n}.')
return
else:
pass
seat_picker()
print(seating_chart)