Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def registerPatient(patientList):
- pID = (input("Enter patient's ID: ")).upper()
- d = []
- for i in range(0,len(patientList)): # check for patient ID
- if (patientList[i][0] == pID):
- print("{} already in queue {}".format(pID,i+1))
- return
- else:
- # prompt input for patient name
- name = input("Enter Patient's name: ").upper()
- # adding new patient information into the list
- d.append(pID)
- d.append(name)
- patientList.append(d)
- queue = len(patientList)
- print(patientList)
- print(d)
- print("{} is registered with queue number {}".format(pID,(queue)))
- def callnext(patientList):
- if not patientList:
- print("No patient in queue")
- else:
- for i in range(0,len(patientList)):
- print("Calling queue number {}".format(i+1))
- print("Serving queue number {}".format(i+1))
- import random
- def doesPatientmissqueue():
- return random.choices([True,False,False,False])
- def listPatient(patientList):
- if not patientList:
- print("There is no patient")
- else:
- print("PatientID:\tName:\tQueue Number:\t Calls Missed:")
- for x in range(0,len(patientList)):
- print("{:9}\t{:6}\t{:13}\t{:14}".format(patientList[x][0],patientList[x][1],(x+1),0))
- def menu():
- while True:
- print("Menu")
- print("1. Register a Patient")
- print("2. Call Next Patient")
- print("3. List Patients in Queue")
- print("4. Search Patient's Queue Position")
- print("5. Record Patients Seen")
- print("0. Exit")
- otp = int(input("Enter option: "))
- if otp in range(6):
- return otp
- else:
- print("invalid input")
- def main():
- patientList = []
- queueMiss = []
- queueNumber = 0
- with open ("patient.txt", "a+") as fout:
- while True:
- choice = menu()
- if choice == 0:
- break
- elif choice == 1:
- registerPatient(patientList)
- elif choice == 2:
- callnext(patientList)
- elif choice == 3:
- listPatient(patientList)
- elif choice == 4:
- break
- elif choice == 5:
- break
- print("End program")
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement