-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
59 lines (43 loc) · 1.47 KB
/
Copy pathmain.py
File metadata and controls
59 lines (43 loc) · 1.47 KB
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
54
55
56
57
58
59
from movie_library import MovieLibrary
library = MovieLibrary('movies.json')
print("All Movies:", library.get_movies())
print()
print("Add New Movie:", library.add_movie(
"The Prestige", "Christopher Nolan", 2006, ["Drama", "Thriller"]))
print()
try:
removed_movie=library.remove_movie("The Matrix")
print("Removed Movie:", removed_movie)
except Exception as e:
print("Exeption trown:", e)
print()
print("Updated Movie:", library.update_movie(
"The Prestige", director="Christopher Nolan", year=2006,
genres=["Drama", "Thriller", "Mystery"]))
print()
print("Movie Titles:", library.get_movie_titles())
print()
print("Count of Movies:", library.count_movies())
print()
print("Movie by Title (Inception):", library.get_movie_by_title("Inception"))
print()
print("Movies by substring (cep):", library.get_movies_by_title_substring("cep"))
print()
print("Movies by Year (2010):", library.get_movies_by_year(2010))
print()
print("Movies by Director (Christopher Nolan):",
library.count_movies_by_director("Christopher Nolan"))
print()
print("Movies by Genre (Sci-Fi):", library.get_movies_by_genre("Sci-Fi"))
print()
print("Oldest Movie:", library.get_oldest_movie_title())
print()
print("Average Release Year:", library.get_average_release_year())
print()
print("Longest Title:", library.get_longest_title())
print()
print("Titles between 1999 and 2014:",
library.get_titles_between_years(1999, 2014))
print()
print("Most Common Year:", library.get_most_common_year())
print()