Question: I want to check if an input value is equal a value inside the list without going through every value inside the list.

```
list=('a','b','c','d')
test=raw_input('enter letter')
if test in list:
   if test == a:
         (code)
   if test == b:
         (code)
   if test == c:
         (code)
   if test == d:
         (code)

```

Answer: 
This is really a tuple not a list. But yes, you can use the `in` membership test for this.

With a `tuple`:

```
In [1]: mtuple=('a','b','c','d')

In [2]: 'a' in mtuple
Out[2]: True

In [3]: 'z' in mtuple
Out[3]: False

```

Works the same with a `list` too:

```
In [4]: mlist=['a','b','c','d']

In [5]: 'a' in mlist
Out[5]: True

In [6]: 'z' in mlist
Out[6]: False

```

More on the membership test with [in](http://docs.python.org/reference/expressions.html#in) toward the bottom of the page:

> 
> The operators in and not in test for collection membership. x in s
>  evaluates to true if x is a member of the collection s, and false
>  otherwise. x not in s returns the negation of x in s. The collection
>  membership test has traditionally been bound to sequences; an object
>  is a member of a collection if the collection is a sequence and
>  contains an element equal to that object. However, it make sense for
>  many other object types to support membership tests without being a
>  sequence. In particular, dictionaries (for keys) and sets support
>  membership testing.
> 
> 
>
Were you thinking of something like this perhaps?

```
def block_a():
    print "AAA"

def block_b():
    print "BBB"

def block_c():
    print "CCC"

d = {"A": block_a, "B" : block_b, "C" : block_c}

test=raw_input('enter letter: ')

d[test]()

```