May 2019
Beginner
528 pages
29h 51m
English
Python provides other built-in functions for manipulating sequences.
We’ve previously shown the built-in reduction functions min and max using arguments, such as ints or lists of ints. Sometimes you’ll need to find the minimum and maximum of more complex objects, such as strings. Consider the following comparison:
In [1]: 'Red' < 'orange'Out[1]: True
The letter 'R' “comes after” 'o' in the alphabet, so you might expect 'Red' to be less than 'orange' and the condition above to be False. However, strings are compared by their characters’ underlying numerical values, and lowercase letters have higher numerical values than uppercase letters. ...
Read now
Unlock full access