I am currently producing a menu-driven program. Here is a code snippet:
def main():
intro()
loop = True
while loop:
print("\n<<<<<<<<<<<<<<<<<<<<<<<<< ||| >>>>>>>>>>>>>>>>>>>>>>>>")
print("\nChoose your option below:")
print("1 - Patient Registration")
print("2 - Total Patients")
print("3 - Total Sales")
print("Q/q - Quit")
choice = str(input("Your choice?"))
print("\n<<<<<<<<<<<<<<<<<<<<<<<<< ||| >>>>>>>>>>>>>>>>>>>>>>>>")
menu(choice)
def intro():
print("Welcome to CTI System.")
print("This system is used to track and manage Covid-19 testing")
def menu(choice):
if choice == '1':
patientRegistration()
elif choice == '2':
testType(pcr,antigen)
elif choice == '3':
totalSales()
elif choice == 'Q' or choice == 'q':
print("\nThank you for using this program.\n")
exit()
else:
print("\nInvalid choice! Please select from the list of choices.\n")
loop = False
When choosing the first choice, it will prompt the user to gather information. Afterwards, once the user is done with the first choice, the user will be prompted to continue, if 'N' then it will go back to the main menu.
This is where where problem starts. I want to choose the 2nd choice in the menu which is the total number of patients. How can I pass the parameters from the first condition to the second?
Your help is greatly appreciated. Thank you!
Aucun commentaire:
Enregistrer un commentaire