Cool! IMO still there is no need to create a new_list. Can you test the below code for some inputs? Should work.
def thirdMax(lister):
lister = list(set(lister))
if len(lister) > 3:
for i in range(0,2):
lister.remove(max(lister))
result = max(lister)
elif len(lister)==3:
result = min(lister)
else:
result = max(lister)
return result
Cool! IMO still there is no need to create a new_list. Can you test the below code for some inputs? Should work.
Great !!! Thanks for your share...
I keep this. Best regards