Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> l = [['NSW', '87'], ['QLD', '49'], ['SA', '14'], ['VIC', '54'], ['WA', '19']]
- >>> highest = max(item[1] for item in l)
- >>> (print(item) for item in l if item[1] == highest)
- ['NSW', '87']
- >>> highest = max(item[1] for item in l)
- >>> for item in l:
- ... if item[1] == highest:
- ... print(item)
- ['NSW', '87']
- >>> keys, values = zip(*l)
- >>> highest = max(values)
- >>> print([keys[values.index(highest)], highest])
- ['NSW', '87']
- 1.819037475 # First Example
- 1.648459721 # Second Example
- 1.406044623 # Third Example
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement