-
Notifications
You must be signed in to change notification settings - Fork 0
/
bolywood.py
53 lines (37 loc) · 1.38 KB
/
bolywood.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
movies=[]
def menu():
user_input=input("Enter 'a' to add a movie,'l' to see ur movies,'f' to find a movie, and 'q' to quit: ")
while user_input!='q':
if user_input=='a':
add_movie()
elif user_input=='l':
show_movie()
elif user_input=='f':
find_by=input("what property of movie u are looking for ?")
looking_for=input("what are u searching for?")
movie = find_movie(looking_for, lambda x: x[find_by])
print(movie or 'No movies found.')
elif user_input=='q':
print("stop program...")
user_input=input("Enter 'a' to add a movie,'l' to see ur movies,'f' to find a movie, and 'q' to quit: ")
def add_movie():
name=input("enter movie name:")
director=input("enter director name:")
year=input("enter the movie release year:")
movies.append({
'name':name,
'director':director,
'year':year
})
def show_movie():
for movie in movies:
print(f"Name: {movie['name']}")
print(f"Director: {movie['director']}")
print(f"Release year: {movie['year']}")
def find_movie(expected,finder):
found=[]
for movie in movies:
if finder(movie) == expected:
found.append(movie)
return found
menu()