Question: 3
write python program ;
Implement the design of the Doctor and Engineer class derived from Personclass so that the following code generates the output below:class Person: def __init__(self, name, contact): self.name = name self.contact = contact def __str__(self): s = f"Name: {self.name}\nContact: {self.contact}" return s#Write your code hered = Doctor("Dr Strange", "4585632", "Neurosurgery", "DMC")d.add_patients("Dhaka Abdur Rahim", "Dhaka John Cena", "Narayanganj JohnWick", "Comilla CM Punk")print("1.=========================================================")print(d)print("2.=========================================================")d.show_patient_list("Dhaka")print("3.=========================================================")d.show_patient_list("Rajshahi")print("4.=========================================================")d.add_patients("Narayanganj Naruto Uzumaki")print("5.=========================================================")print(d)print("6.=========================================================")eng = Engineer("Howard Wolowitz", "982685", "Mechanical")eng.add_projects("Mongol Tori Bangladesh", "Duburi Bangladesh", "CuriosityRover USA", "Perseverence USA")print("7.=========================================================")print(eng)OUTPUT:1.=========================================================Doctor Details:Name: Dr StrangeContact: 4585632Speciality: NeurosurgeryHospital: DMCPatients List:{'Dhaka': ['Dhaka Abdur Rahim', 'Dhaka John Cena'], 'Narayanganj':['Narayanganj John Wick'], 'Comilla': ['Comilla CM Punk']}2.=========================================================Patients from Dhaka:Dhaka Abdur RahimDhaka John Cena3.=========================================================Dr Strange has not patients from Rajshahi4.=========================================================5.=========================================================Doctor Details:Name: Dr StrangeContact: 4585632Speciality: NeurosurgeryHospital: DMCPatients List:{'Dhaka': ['Dhaka Abdur Rahim', 'Dhaka John Cena'], 'Narayanganj':['Narayanganj John Wick', 'Narayanganj Naruto Uzumaki'], 'Comilla':['Comilla CM Punk']}6.=========================================================7.=========================================================Engineer Details:Name: Howard WolowitzContact: 982685Field: MechanicalProject List: {'Bangladesh': ['Mongol Tori Bangladesh', 'DuburiBangladesh'], 'USA': ['Curiosity Rover USA', 'Perseverence USA']}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here