In this program it says patients_data.txt is not defined. Can you please check where am I going wrong on this.# Print Details of the programprint(“This program reads a file patients_data.txt “)print(“stores each line in a dictionary. Then this program have options like.”)print(“Find a particular patient average costs by patient name”)print(“Delete patient data”)print(“Add new patient data”)print(“Write patient data to file”)print(“Show all patient details”)print(“Exit program”)# Function to read filedef file_read_file(): patient_data = {} while True: file_name = input(“nEnter file: “) try: _file = open(file_name, ‘r’) break except FileNotFoundError: print(file_name,” does not exist.”) continue for file_line in _file: file_line = file_line.strip() if len(file_line) != 0: file_line = file_line.split(‘,’) patient_data[file_line[0]] = [file_line[1], file_line[2], file_line[3]] _file.close() return patient_data# Function to find Patient’s average cost of visitsdef Cost_Average(p_info): name = input(“nEnter Patient name: “).title() if name in p_info: total = 0 for cost in p_info[name]: total += int(cost) average = total / 3 print(“Average costs of “+name+”:”,average) else: print(name,”not found!”)# Function to delete Patient datadef deletePatient(p_info): name = input(“nEnter Patient name to delete: “) if name in p_info: del p_info[name] print(“Patient deleted!”) return p_info else: print(name,”not found!”) return p_info# Function to show all Patients datadef showDetails(p_info): print(“n Patient t costs “) for name,costs in p_info.items(): print(name+”t”+str(costs))# Function to add new Patientdef addPatients(p_info): name = input(“nEnter name of the Patient: “) costs = [] for i in range(3): visit_costs = int(input(“Enter costs of visit#”+str(i+1)+”: “)) costs.append(str(visit_costs)) p_info[name] = costs print(“Patient added!”) return p_info# Function to write data into filedef visit_writeData(p_info): while True: try: file_name = input(“nEnter file name to write: “) _file = open(file_name, ‘w’) break except FileNotFoundError: print(file_name,”not found!”) continue for name,costs in p_info.items(): _file.write(name+”,”+”,”.join(costs)+”n”) _file.close() print(“Data written into file.”)visit_data = file_read_ftn()# Loop to simulate menuwhile True: print(“n>>> Menu”) print(“1. Find Patients average”) print(“2. Delete Patient data”) print(“3. Add new Patient” ) print(“4. Write Patients data to file”) print(“5. Show Patient details”) print(“0. Exit”) option = input(“Select option: “) while option not in [‘0′,’1′,’2′,’3′,’4′,’5’]: print(“Invalid option. Try again”) option = int(input(“Select option: “)) if option == ‘1’: Cost_Average(visit_data) elif option == ‘2’: visit_data = deletePatient(visit_data) elif option == ‘3’: visit_data = addPatients(visit_data) elif option == ‘4’: visit_writeData(visit_data) elif option == ‘5’: showDetails(visit_data) else: breakprint(“nThanks for using this program !!!”)Computer ScienceEngineering & TechnologyPython Programming BIM IT-218

Order your essay today and save 20% with the discount code ESSAYHELP