Editor settings

General settings

Save settings

Learn to program with Python

Check a list for value #

Write a function that checks if a given value exists in a list. The function takes a list as the first argument and the value to find in the second argument.

We recommend that you do not use the in operator for this challenge and try to solve the problem on your own.


Tests #

  • does_list_contain([1, 2, 3], 1) should return True
  • does_list_contain([1, 2, 3], 0) should return False
  • does_list_contain(["A", "B", "C"], "A") should return True
  • does_list_contain(["A", "B", "C"], "a") should return False
  • does_list_contain(["A", "B", "C"], 0) should return False
Output will be displayed here