import random
from collections import deque
from time import sleep
my_queue = deque([])
def user_input():
print("Menu")
print("1. Register a customer")
print("2. Call next customer")
print("3. List customers in queue")
print("0. Exit")
menu_number = int(input("Please choose : "))
if menu_number == 1:
register_customer()
user_input()
elif menu_number == 2:
call_customer()
user_input()
elif menu_number == 3:
list_customers()
user_input()
elif menu_number == 0:
return
def register_customer():
customer_name = input("May I have your name please : ")
if len(my_queue) == 0:
my_queue.append({
'customer': customer_name,'queue_no': random.randint(1,5)*100,'missedcalls': 0
})
else:
my_queue.append({
'customer': customer_name,'queue_no': my_queue[-1]['queue_no']+1 ,'missedcalls': 0
})
def call_customer():
customer_servedno = 0
customer_served = []
if len(my_queue) == 0:
print("There are no customers in queue.")
else:
customer = my_queue.popleft()
while customer_servedno >= 0 :
print("Calling queue no" + "your waffle is ready")
sleep(1)
if random.randint(0,3) == 1:
print (str(customer['queue_no']) +' '+ customer['customer'] +' ' + "has been served")
customer_served.append(customer['customer'])
customer_servedno += 1
else:
print("Has tried 3 times calling Queue number" + ' ' + str(customer['queue_no']))
my_queue.append(customer)
my_queue.append(customer['missedcalls']+1)
def list_customers():
if len(my_queue) == 0:
print("There are no customers in queue.")
else:
print("Queue Number\t" + my_queue['queue_no'] + "Customer Name\t" + my_queue['customer'] + "No of missed calls\t" + my_queue['missedcalls'])
user_input()
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of