Please check my code for errors | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please check my code for errors

An error of patients_management not defined is showing up This python file is linked with mysql where i have already made the tables of patients, doctors, billing(without any entries) So why do you think it is not accessing MySQL or should I make the full program after that run the test for error as this not the full code #python code import mysql.connector mydb=mysql.connector.connect( host='localhost', user='root', password='12345', database='hospital') mycursor=mydb.cursor() #main menu def Main_menu(): while True: print("\t________________________________________________________") print("\*******WELCOME TO HOSPITAL MANAGEMENT SYSTEM *") print("\t________________________________________________________") print("\n\t***** MAIN MENU *****") print("1: patients management Menu") print("2: Doctor Management Menu ") print("3: Billing Management Menu") print("4:Exit") print("\t___________________________________________________________") choice=int(input("Enter Your Choice:")) if choice==1: patients_management() elif choice==2: doctor_Management() elif choice==3: billing_Management() elif choice==4: break else: print("ERROR: Invalid Choice Try Again") con=input("press any key to continue") Main_menu() #patient Management Menu def patients_management(): while True: print("\t____________________________________________") print("\t********patient DETAILS********") print("\t____________________________________________ ") print("1: Add patient Details") print("2: Search patient Details") print("3: View all patient Details") print("4:Edit patient Details") print("5: Delete patient Details") print("6: Return Main Menu") print("\t_________________________________

7th Nov 2023, 11:46 AM
Ayushi
1 Answer
+ 3
move the def patient_management block to before def Main_ menu and see dose it work or not
7th Nov 2023, 3:28 PM
**🇦🇪|🇦🇪**
**🇦🇪|🇦🇪** - avatar