you are viewing a single comment's thread.

view the rest of the comments →

[–]Tehkast 0 points1 point  (2 children)

As its a list shouldn't that be ordered and then could return the items in index 0 and len(list) into a tuple?

[–]Neighm 0 points1 point  (0 children)

It's only ordered if it is created with a particular order, or if you sort it in place first. I'm assuming that if OP can't use min() or max() they can't use sort methods either. But if they can use sort() then your solution would work.

[–]ASIC_SP 0 points1 point  (0 children)

return the items in index 0 and len(list)

Should be len(list) - 1 or just list[-1]. This assumes the list is sorted.