I am working on a data structure list class in python. I would like to get the largest item in the list.
inlist = self.data
if inlist[0] > inlist[1]:
largest = inlist[0]
else:
largest = inlist[1]
for item in inlist[2]:
if item > largest:
largest = item
return largest
With the above getting stuck at largest gets returns
<bound method ListData.largest2 of <list.ListData instance at 0x2b35602c3440>>
while the data
[2, 5]
You can use the build in max() function.