def f (x): return x**2
print (f(8))

g = lambda x: x**2
print (g(8))
def make_incrementor (n): return lambda x: x + n

f = make_incrementor(2)
g = make_incrementor(6)

print (f(42), g(42))

Call filter() for each element of the list, and returns a new list that contains only those elements for which the function returned "True"

foo = [2, 18, 9, 22, 17, 24, 8, 12, 27]

def divisibleBy3 (x):
    return x % 3 == 0

print (list (filter (divisibleBy3, foo)))

print (list (filter (lambda x: x % 3 == 0, foo)))
print (list (map(lambda x: x * 2 + 10, foo)))

from functools import reduce
print (reduce(lambda x, y: x + y, foo))

In the following example, a sentence is split up into a list of words, then a list is created that contains the length of each word

sentence = 'It is raining cats and dogs'
words = sentence.split()
print (words)

lengths = list (map(lambda word: len(word), words))
print (lengths)

Multiway branch switches

key = 'got'
value = {'already': (lambda: 2 + 2),
 'got':     (lambda: 2 * 4),
 'one':     (lambda: 2 ** 6)}[key]()

print (value)
def f1(): return 2 + 2
def f2(): return 2 * 4
def f3(): return 2 ** 6

key = 'one'
print ({'already': f1, 'got': f2, 'one': f3}[key]())