PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class Patient:
def __init__(self, patient_id, name, age, ailment):
self.patient_id = patient_id
self.name = name
self.age = age
self.ailment = ailment
def display(self):
return f"Patient ID: {self.patient_id} | Name: {self.name} | Age: {self.age} | Ailment: {self.ailment}"
class Doctor:
def __init__(self, doctor_id, name, specialty):
self.doctor_id = doctor_id
self.name = name
self.specialty = specialty
def display(self):
return f"Doctor ID: {self.doctor_id} | Name: {self.name} | Specialty: {self.specialty}"
class Hospital:
def __init__(self):
self.patients = []
self.doctors = []
self.appointments = {}
def add_patient(self, patient):
self.patients.append(patient)
print(f"Patient {patient.name} registered successfully!")
Enter to Rename, Shift+Enter to Preview
OUTPUT
Correr