fork download
  1. titles = ['james','tom','kim']
  2. locations = [5,6,9]
  3.  
  4. find_str = input('Find Names (separated by space): ')
  5. terms = find_str.split() # split entered string by delimiter space into a list
  6.  
  7. print('Searching for terms:', terms)
  8. for t in terms:
  9. if t.lower() in titles:
  10. i = titles.index(t.lower())
  11. loc = locations[i]
  12. print("Found given term:", t, "on index:", i, " has location:", loc)
Success #stdin #stdout 0.03s 9684KB
stdin
James t. kirk
stdout
Find Names (separated by space): Searching for terms: ['James', 't.', 'kirk']
Found given term: James on index: 0  has location: 5