You can use the max() function to find the maximum value in a data set. This function accepts an iterable as an argument, such as a list or tuple, and returns the largest item in the sequence.
Here's an example:
main.py74 chars4 lines
This will output:
main.py3 chars2 lines
If your data set contains non-numeric values, you can pass a key function as a second argument to the max() function. For example, to find the longest string in a list of strings, you could use:
main.py101 chars4 lines
This will output:
main.py7 chars2 lines
gistlibby LogSnag