Created
June 25, 2018 14:19
-
-
Save messiest/b39161deb644e1273f2380a079f25d02 to your computer and use it in GitHub Desktop.
Return the index of the string that contains the substring
This file contains 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
def substring_index(strings, substring): | |
for i, s in enumerate(strings): | |
if substring in s: | |
return i | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment