Created
November 10, 2017 01:50
-
-
Save vedgar/4d2ed55479e960f90d350d5ec75b20c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import contextlib | |
| def second_index(text: str, symbol: str): | |
| """Second index of a symbol in a given text.""" | |
| with contextlib.suppress(ValueError): | |
| manhattan = text.index(symbol) | |
| berlin = text.index(symbol, manhattan + 1) | |
| return berlin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment