# Import the necessary libraries.
import sys
# Create a dictionary to store the movie details.
movie_details = {}
# Define a function to print the menu.
def print_menu():
print("Welcome to the Movie Screening Menu!")
print("1. Add a movie.")
print("2. View all movies.")
print("3. Exit.")
# Define a function to add a movie to the dictionary.
def add_movie():
# Get the movie name from the user.
movie_name = input("Enter the movie name: ")
# Get the number of halls from the user.
number_of_halls = int(input("Enter the number of halls: "))
# Add the movie details to the dictionary.
movie_details[movie_name] = number_of_halls
# Define a function to view all the movies in the dictionary.
def view_all_movies():
# Print the list of movies.
for movie_name in movie_details:
print(movie_name)
# Define a function to exit the program.
def exit_program():
sys.exit()
# Keep looping until the user wants to exit.
while True:
# Print the menu.
print_menu()
# Get the user's choice.
user_choice = input("Enter your choice: ")
# Validate the user's choice.
if user_choice not in ["1", "2", "3"]:
print("Invalid choice. Please try again.")
continue
# Perform the action corresponding to the user's choice.
if user_choice == "1":
add_movie()
elif user_choice == "2":
view_all_movies()
else:
exit_program()