Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #I defined menu
- #I defined menu for Admin
- #I declared the user name and password for Admin
- def menu():
- print("[1] Admin")
- print("[2] Guest")
- print("[3] Customer")
- print("[0] Exit the system.")
- def admin_menu():
- print("[10} Sign out")
- print("[11] Upload med")
- print("[12] View med")
- print("[13] Update med")
- print("[14] Delete med")
- print("[15] Search med")
- print("[16] View order")
- print("[17] Search order")
- print("[18] Exit the system.")
- def admin_commands(op):
- print("-"*10)
- if op ==11:
- print("Upload")
- elif op ==12:
- print("View upload")
- elif op ==13:
- print("Update")
- elif op ==14:
- print("Delete")
- elif op ==15:
- print("Search")
- elif op ==16:
- print("View order")
- elif op ==17:
- print("Search order")
- elif op ==18:
- print("Exit to main menu")
- else:
- print("Invalid option.")
- print("-"*10)
- #I defined the adminlog
- def adminlog(username, password):
- print("\nYou are directed to Admin")
- print("\nPlease enter your username and password.")
- name=input("Username:")
- passw=input("Password:")
- if name==username:
- if passw==password:
- print("\nWelcome", username)
- while True:
- admin_menu()
- op = int(input("Enter your option: "))
- if op ==10:
- return
- admin_commands(op)
- else:
- print ("\nThe username or password you have entered is incorrect")
- #Called menu so user chooses the options provided
- #when user chooses option 1 he gets directed to option1() --> adminlog()
- def main():
- username = "joe"
- option = None
- password = "joe"
- while option !=0:
- menu()
- option = int(input("Enter your option: "))
- if option ==1:
- adminlog(username, password)
- elif option ==2:
- print("You are directed to Guest")
- elif option ==3:
- print("You are directed to Customer")
- else:
- print("Invalid option.")
- print()
- print("Thank you for using this program. Goodbye.")
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment