0% found this document useful (0 votes)
11 views2 pages

PATIENT - Doc Python

Uploaded by

Mydeen M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

PATIENT - Doc Python

Uploaded by

Mydeen M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

# Enter your code here. Read input from STDIN.

Print output to STDOUT

class Patient:
def __init__(self, Code, Name, age, doctorName, billAmount):
self.Code=Code
self.Name=Name
self.age=age
self.doctorName=doctorName
self.billAmount=billAmount

class Doctor:
def __init__(self, Doctor, PatientList):
self.Doctor=Doctor
self.PatientList=PatientList

def findPatientWithMaximumAge(self):
if len(self.PatientList)>0:
fmax=max(self.PatientList, key=lambda x:x.age)
return fmax
else:
return None

def sortPatientByBillAmount(self):
l=[]
if len(self.PatientList)>0:
for i in self.PatientList:
l.append(i.billAmount)
l.sort()
return l
else:
return None

passList=[]
n=int(input())
for i in range(n):
Code=input()
Name=input()
age=int(input())
doctorName=input()
billAmount=float(input())
passList.append(Patient(Code, Name, age, doctorName, billAmount))

dobj=Doctor("XYZ", passList)

res1=dobj.findPatientWithMaximumAge()
res2=dobj.sortPatientByBillAmount()

if res1:
print(res1.Code)
print(res1.Name)
print(res1.age)
print(res1.doctorName)
print(res1.billAmount)
else:
print("No Data Found")

if res2:
for i in res2:
print(i)
else:
print("No Data Found")

You might also like