The sum, max, and min functions

These functions are pretty much self-explanatory: they will try to summarize or compare values in iterables. Just remember that for the dictionary, its keys—not values—will be used:

sum({1:'A', 2:'B'})
>>> 3

Note that min and max don't require elements to be integers or floats:

max({'A':1, 'B':2})
>>> 'B'
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset