#functions that accepts other functions as parameter
def greet():
print('Hello')
def before_and_after(func):
print('Before')
func()
print('After')
#before_and_after(greet)
#before_and_after(lambda: 5)
books = [
{'name': 'Matrix', 'Director': 'Wahowski'},
{'name': 'Matrix2', 'Director': 'Wahowski'},
{'name': 'Ogniem I mieczem', 'Director': 'WAJDA'},
{'name': 'Chlopi', 'Director': 'Rejmond'},
{'name': 'QV', 'Director': 'Sienkiewicz'},
{'name': 'LORD', 'Director': 'Tolkien'}
]
def find_book(expected,finder):
list = []
for book in books:
if finder(book) == expected:
list.append(book)
return list
find_by = input('What property are u searching by?')
looking_for = input('What are u looking for?')
book = find_book(looking_for ,lambda book: book[find_by])
print(book or 'No mowies found')