Advertisement
here2share

# string_index.py

Jan 21st, 2021
807
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. # string_index.py
  2.  
  3. LLL = ['zero', 'one', 'two', 'three', 'four', 'five']
  4.  
  5. def fn(s): return LLL.index(s) if s in LLL else '!!! *'+s+'* Not Found In List'
  6.  
  7. print(fn("three"))
  8. print(fn("ten"))
  9. print(fn("two"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement