my_str = "This is a test string from Andrew"
sorted(my_str.split(), key=str.lower)
* "key" parameter to specify a function to be called on each list element prior to making comparisons.
sorted(my_str.split(), key=str.lower, reverse=True)
sorted(my_str.split(), key=str.lower)
* "key" parameter to specify a function to be called on each list element prior to making comparisons.
sorted(my_str.split(), key=str.lower, reverse=True)
No comments:
Post a Comment