File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
course_contents/3_first_milestone_project Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ MENU_PROMPT = """
3
+ Enter a choice
4
+ Add a movie > a
5
+ View all movies > v
6
+ Find a movie > f
7
+ Quit > q
8
+ >>
9
+ """
10
+
11
+ #movies = {"title":[],"director":[],"year":[]}
12
+ movies = []
13
+
14
+ def Add_Movie ():
15
+ title = input ('enter movie title: ' )
16
+ director = input ('enter director: ' )
17
+ year = input ('enter year: ' )
18
+
19
+ movies .append ({
20
+
21
+ "title" :title ,
22
+ "director" :director ,
23
+ "year" :year
24
+ })
25
+
26
+ return movies
27
+
28
+ def View_Movies (movies ):
29
+ for movie in movies :
30
+ print (movie )
31
+
32
+ def Find_Movie ():
33
+ inp = input ('enter movie to find: ' )
34
+ if inp in movies ["title" ]:
35
+ print (movies ["title" ], movies ["director" ], movies ["year" ])
36
+ else :
37
+ print ("Movie not found in inventory" )
38
+
39
+ choice = input (MENU_PROMPT )
40
+ while choice != 'q' :
41
+ if choice .lower () == 'a' :
42
+ Add_Movie ()
43
+ elif choice .lower () == 'v' :
44
+ View_Movies (movies )
45
+ elif choice .lower () == 'f' :
46
+ Find_Movie ()
47
+ elif choice .lower () == 'q' :
48
+ break
49
+ else :
50
+ print ('Invalid choice' )
51
+
52
+ choice = input (MENU_PROMPT )
53
+
54
+
You can’t perform that action at this time.
0 commit comments