- index
Index improved
examples/lists/index_improved.py
words = ['cat', 'dog', 'snake', 'camel'] name = 'snake' if name in words: print(words.index(name)) name = 'python' if name in words: print(words.index(name))
words = ['cat', 'dog', 'snake', 'camel'] name = 'snake' if name in words: print(words.index(name)) name = 'python' if name in words: print(words.index(name))