fork download
  1. def find_value_indexes(item_list, index_list, v):
  2. """ (list of object, list of int, object) -> list of int
  3.  
  4. Precondition: the values in index_list are valid indexes in item_list.
  5.  
  6. v may appear multiple times in item_list. index_list contains zero or
  7. more indexes. Return a list of the indexes from index_list at which v
  8. appears in item_list.
  9.  
  10. >>> find_value_indexes([6, 8, 8, 5, 8], [0, 2, 4], 8)
  11. [2, 4]
  12. """
  13. final_list = []
  14.  
  15. for i in item_list:
  16. if item_list[i] == v and i in index_list:
  17. final_list.append(i)
  18.  
  19. return final_list
Success #stdin #stdout 0.02s 9056KB
stdin
Standard input is empty
stdout
Standard output is empty