I am creating a simple queue system with Python, however there is just one problem: I have coded yet the terminal just does not show the results I need. Maybe a problem with the coding?
The image shown here is what I got: enter image description here
Here is the Python code I've used:
# code
import queue
from time import sleep
from tkinter import Menu
ticket = 2000
ticket_in_queue = []
table_assignment = {
'Table 1': 'Not assigned',
'Table 2': 'Not assigned',
'Table 3': 'Not assigned',
'Table 4': 'Not assigned',
}
def add_ticket(ticket):
ticket_in_queue.append(ticket)
return ticket_in_queue
# message
print("Enter 0 to 5 for following options:")
print("0 -> Issue new ticket number")
print("1 -> Assign first ticket in queue in Table 1")
print("2 -> Assign first ticket in queue in Table 2")
print("3 -> Assign first ticket in queue in Table 3")
print("4 -> Assign first ticket in queue in Table 4")
print("5 -> Quit program")
print("Tickets in queue:", ticket_in_queue)
print("Table assignment:",table_assignment)
option = " "
while option != "exit":
option = input("Enter your option: ")
if option == "0":
ticket += 1
add_ticket(ticket)
print("Tickets in queue:", ticket_in_queue)
print("Table assignment:",table_assignment)
elif option == "1":
table_assignment['Table 1'] = ticket
print("Tickets in queue:", ticket_in_queue)
print("Table assignment:",table_assignment)
elif option == "2":
table_assignment['Table 2'] = ticket
print("Tickets in queue:", ticket_in_queue)
print("Table assignment:",table_assignment)
elif option == "3":
table_assignment['Table 3'] = ticket
print("Tickets in queue:", ticket_in_queue)
print("Table assignment:",table_assignment)
elif option == "4":
table_assignment['Table 4'] = ticket
print("Tickets in queue:", ticket_in_queue)
print("Table assignment:",table_assignment)
elif option == "5":
print("Quitting program...")
quit()
else:
print("Invalid option")
Any assistance will be appreciated. Thank you.