raise_to_power = lambda x, y: x ** y
raise_to_power(2, 3)
nums = [48, 6, 9, 21, 1]
square_all = map(lambda num: num ** 2, nums)
print(square_all)
print(list(square_all))
spells = ["protego", "accio", "expecto patronum", "legilimens"]
shout_spells = map(lambda item: item + '!!!', spells) # Use map() to apply a lambda function over spells
shout_spells_list = list(shout_spells) # Convert shout_spells to a list: shout_spells_list=
print(shout_spells_list)
fellowship = ['frodo', 'samwise', 'merry', 'pippin', 'aragorn', 'boromir', 'legolas', 'gimli', 'gandalf']
result = filter(lambda member: len(member) > 6, fellowship) # Use filter() to apply a lambda function over fellowship
result_list = list(result) # Convert result to a list
print(result_list)
from functools import reduce # Import reduce from functools
stark = ['robb', 'sansa', 'arya', 'brandon', 'rickon']
result = reduce(lambda item1, item2: item1 + item2, stark) # Use reduce() to apply a lambda function over stark
print(result)