Python
Programming Exercises, Gently Explained
21
more concise numberStr[-2:] in ('11', '12', '13'). Enter the following into the
interactive shell:
>>> numberStr = '41096'
>>> numberStr[-2:] in ('11', '12', '13')
False
>>> numberStr = '512'
>>> numberStr[-2:] in ('11', '12', '13')
True
You’ll use a similar expression in this exercise’s solution.
Dostları ilə paylaş: