movies = []
START = "\n=========== Movie Management System ===========\n\n\nEnter 1 to Add Movies, \nEnter 2 to Display Movies \nEnter 3 to Search a Movie by Title \nEnter 4 to Quit Application \n"
def add_movie():
title = input("Enter title of the film: ")
director = input("Enter director of the film: ")
year = input("Enter year of the film: ")
genre = input("Enter genre of the film: ")
movies.append({
'title': title,
'year': year,
'director': director,
'genre': genre
})
def list_movies():
quantity = len(movies)
titles = [movie['title'] for movie in movies]
titles = '\n'.join(titles)
if quantity:
print(f'\nList of movies that have in your collection: \n{titles}. \nIn total you have {quantity} {"movie" if quantity == 1 else "movies"}.')
else:
print('There are no movies in your collection.')
def print_movie_info(movie):
print('Here is information about requested title')
print(f'Title: {movie["title"]},')
print(f'Director: {movie["director"]},')
print(f'Year: {movie["year"]},')
print(f'Genre: {movie["genre"]}.')
def find_title():
search_title = input('Enter title you are looking for: ')
for movie in movies:
if movie['title'] == search_title:
print_movie_info(movie)
else:
print('Requested title was not found in the collection.')
user_selection = {
'1': add_movie,
'2': list_movies,
'3': find_title
}
def menu():
selection = input(START)
while selection != '4':
if selection in user_selection:
selected_action = user_selection[selection]
selected_action()
else:
print("Unknown command. Please choose within available options: 1, 2, 3 or 4 to close the app.")
selection = input(START)
print('Thank you for using the app. See you next time!')
if __name__ == '__main__':
menu()
没有合适的资源?快使用搜索试试~ 我知道了~
Python 电影管理系统源代码
共1个文件
py:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 192 浏览量
2024-02-29
22:47:51
上传
评论
收藏 943B ZIP 举报
温馨提示
电影管理系统仅使用 Python 编程语言创建。该系统是一个用户友好的应用程序,可以轻松适应您的需求。该项目可以公开使用,无需任何登录凭据。该系统提供了一种管理您的电影收藏的有效方法。用户可以通过输入有关电影的所需信息来添加新的电影名称。您还可以查看收藏中的电影总数。如果要将电影列表存储在数据库中,只需在保存脚本中添加数据库连接即可。 安装指南 下载并安装Python IDLE,这里是链接“https://www.python.org/downloads/”。 下载此站点的源代码。 找到并解压缩 zip 文件。 打开解压缩的文件夹 找到 py 文件。 然后通过 python IDLE 或任何支持 python 语言的 IDE 打开文件。 运行 py 文件以启动程序。
资源推荐
资源详情
资源评论
收起资源包目录
MovieManagementSysteminPython.zip (1个子文件)
MovieManagementSysteminPython
index.py 2KB
共 1 条
- 1
资源评论
新华
- 粉丝: 9907
- 资源: 618
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功