-
Notifications
You must be signed in to change notification settings - Fork 0
/
sitting arrangement 2.3.py
69 lines (57 loc) · 1.56 KB
/
sitting arrangement 2.3.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
rowsOfChair = [[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],]
delegate = 1
count = 0
for row in range(0, len(rowsOfChair)):
if row == 0:
for seat in range(0, 5):
if seat == 1 or seat == 3:
rowsOfChair[row][seat] = delegate
count += 1
if row == 19:
for seat in range(0, 5):
if rowsOfChair[row - 1][seat] == 0:
rowsOfChair[row][seat] = delegate
count += 1
for seat in range(0, 5):
if seat == 0:
if rowsOfChair[row - 1][seat] == 0 and rowsOfChair[row + 1][seat] == 0 and rowsOfChair[row][seat + 1] == 0:
rowsOfChair[row][seat] = delegate
count += 1
if seat == 4:
if rowsOfChair[row - 1][seat] == 0 and rowsOfChair[row + 1][seat] == 0 and rowsOfChair[row][seat - 1] == 0:
rowsOfChair[row][seat] = delegate
count += 1
if rowsOfChair[row][seat] == 0:
if rowsOfChair[row - 1][seat] == 0 and rowsOfChair[row + 1][seat] == 0 and rowsOfChair[row][seat - 1] == 0 and rowsOfChair[row][seat + 1] == 0:
rowsOfChair[row][seat] = delegate
count += 1
print("Sitting Arrangement: \n")
def displayTable():
for row in range(0,len(rowsOfChair)):
for seat in range(0,5):
print(rowsOfChair[row][seat], end=' ')
if seat == 4:
print('\t')
displayTable()
print("Number of seated delegates: ", count)
print("Number of seats: ", len(rowsOfChair) * 5)
print("Number of empty seats: ", (len(rowsOfChair) * 5) - count)