fork download
  1. # your code goes here
  2. all_names = ["A", "Ann", "Bob", "John", "Mortimer"]
  3.  
  4.  
  5. def get_between(names, first, last):
  6. f = l = False
  7. for n in names:
  8. l = l or n == last
  9. if f and not l:
  10. yield n
  11. f = f or n == first
  12.  
  13. print([i for i in get_between(all_names, "Ann", "John")])
Success #stdin #stdout 0.02s 8736KB
stdin
Standard input is empty
stdout
['Bob']