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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access