Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Здравейте господине, това е проекта ми. Идеята на проекта ми е програма, която запаметява филм, който си изгледал. Надявам се да ви хареса!
- # това е без файлове:
- film_collection = []
- while True:
- izbor = input("Choose to: add, remove, show, exit. Enter your choice: ").lower()
- if izbor == "add":
- title = input("Enter the title of the film: ")
- genre = input("Enter the genre of the film: ")
- year = input("Enter the release year of the film: ")
- rating = input("Enter the rating of the film: ")
- film = {
- 'title': title,
- 'genre': genre,
- 'year': year,
- 'rating': rating
- }
- film_collection.append(film)
- print("Film is added!")
- elif izbor == "remove":
- title_to_remove = input("Enter the title of the film to remove: ")
- for film in film_collection:
- if film['title'] == title_to_remove:
- film_collection.remove(film)
- print(f"Film '{title_to_remove}' is removed !")
- break
- else:
- print(f"Film '{title_to_remove}' not found.")
- elif izbor == "show":
- if film_collection:
- print("Films in the collection:")
- for film in film_collection:
- print(f"Title: {film['title']}, Genre: {film['genre']}, Year: {film['year']}, Rating: {film['rating']}")
- else:
- print("No films in the collection.")
- elif izbor == "exit":
- print("Exiting the program.")
- break
- else:
- print("Invalid choice.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement