6.20. Exercises
6-1. Strings. Are there any string methods or functions in the string module that will help me determine if a string is part of a larger string?
6-2. String Identifiers. Modify the idcheck.py script in Example 6-1 such that it will determine the validity of identifiers of length 1 as well as be able to detect if an identifier is a keyword. For the latter part of the exercise, you may use the keyword module (specifically the keyword.kwlist list) to aid in your cause.
6-3. Sorting.
(a) Enter a list of numbers and sort the values in largest-to-smallest order.
(b) Do the same thing, but for strings and in reverse alphabetical (largest-to-smallest lexicographic) order.
6-4. Arithmetic. Update your solution to the test score exercise in ...
Get Core Python Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.