-7

So basically I want to write a function which checks if the list contains a given as parameter value.

For example:

l = ['ala', 'bala', 'alabala']
Dimitris Fasarakis Hilliard
  • 150,925
  • 31
  • 268
  • 253

1 Answers1

2

Simple function:

def isIn(item, list):
   return(item in list)

l = ['ala', 'bala', 'alabala']
print(isIn('bala',l))

As an example. Please google the answer before posting the question, or try to show what you have tried in the future.

Fastest way to check if a value exist in a list

Shows any number of ways to do this

Lain
  • 2,166
  • 4
  • 23
  • 47
  • Better idea: Don't google solutions, but try to learn Python with the [tutorial](https://docs.python.org/3/tutorial/index.html). – Matthias Jun 06 '17 at 17:13