Skip to content

Instantly share code, notes, and snippets.

@aadityabhatia
Last active September 10, 2024 19:20
Show Gist options
  • Select an option

  • Save aadityabhatia/86077fea4ccd353bfb017df733a70d19 to your computer and use it in GitHub Desktop.

Select an option

Save aadityabhatia/86077fea4ccd353bfb017df733a70d19 to your computer and use it in GitHub Desktop.
Classroom Seating Chart
a1 = [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
]
from random import shuffle
def printSeatChart(roster):
# add empty strings to make the class size 17
roster += [""] * (17 - len(roster))
# shuffle the list
shuffle(roster)
# add one more to block seat #6
if len(roster) == 17:
roster = roster[:5] + [""] + roster[5:]
print("DOOR".ljust(24) + "WHITEBOARD".center(24) + "INSTRUCTOR".center(24))
print('*' * 84)
for i in range(0, len(roster), 6):
for j in range(3):
print(f"{roster[i+j]:^12}", end="")
print(' ' * 12, end="")
for j in range(3, 6):
print(f"{roster[i+j]:^12}", end="")
print()
print('*' * 84)
print("REAR".center(84))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment