import time # ------------------------------------------ # COMPLETE DATASET FOR ALL COMBINATIONS # ------------------------------------------ recommendations = { "movie": { "action": { "happy": "Spider-Man: Homecoming", "sad": "Logan", "excited": "Mad Max: Fury Road", "thoughtful": "Inception", "scared": "A Quiet Place", "bored": "John Wick", "relaxed": "The Avengers" }, "romance": { "happy": "La La Land", "sad": "The Notebook", "excited": "Crazy Rich Asians", "thoughtful": "Before Sunrise", "scared": "Warm Bodies", "bored": "To All the Boys I’ve Loved Before", "relaxed": "Pride & Prejudice" }, "sci-fi": { "happy": "The Martian", "sad": "Interstellar", "excited": "Guardians of the Galaxy", "thoughtful": "Arrival", "scared": "Alien", "bored": "Star Trek", "relaxed": "Wall-E" }, "horror": { "happy": "Happy Death Day", "sad": "The Sixth Sense", "excited": "The Conjuring", "thoughtful": "Get Out", "scared": "Hereditary", "bored": "Insidious", "relaxed": "Gremlins" }, "comedy": { "happy": "Jumanji", "sad": "The Intern", "excited": "21 Jump Street", "thoughtful": "The Truman Show", "scared": "Zombieland", "bored": "Mr. Bean's Holiday", "relaxed": "Yes Man" }, "mystery": { "happy": "Knives Out", "sad": "Shutter Island", "excited": "Enola Holmes", "thoughtful": "Gone Girl", "scared": "The Others", "bored": "Now You See Me", "relaxed": "The Da Vinci Code" }, "fantasy": { "happy": "Harry Potter", "sad": "Bridge to Terabithia", "excited": "The Lord of the Rings", "thoughtful": "Pan’s Labyrinth", "scared": "The Witcher: Nightmare of the Wolf", "bored": "Percy Jackson", "relaxed": "Narnia" }, "drama": { "happy": "The Pursuit of Happyness", "sad": "A Star Is Born", "excited": "Whiplash", "thoughtful": "The Social Network", "scared": "Black Swan", "bored": "Forest Gump", "relaxed": "The Secret Life of Walter Mitty" }, "thriller": { "happy": "Enemy of the State", "sad": "Seven", "excited": "Mission Impossible", "thoughtful": "Memento", "scared": "It", "bored": "The Bourne Identity", "relaxed": "The Prestige" }, "adventure": { "happy": "Pirates of the Caribbean", "sad": "Life of Pi", "excited": "Indiana Jones", "thoughtful": "Cast Away", "scared": "King Kong", "bored": "Journey to the Center of the Earth", "relaxed": "Up" } }, # ------------------------------------------ # BOOKS # ------------------------------------------ "book": { "action": { "happy": "The Hunger Games", "sad": "The Fault in Our Stars (Action elements)", "excited": "Alex Rider Series", "thoughtful": "The Maze Runner", "scared": "The Shining", "bored": "Divergent", "relaxed": "Treasure Island" }, "romance": { "happy": "The Rosie Project", "sad": "Me Before You", "excited": "The Selection", "thoughtful": "The Time Traveler's Wife", "scared": "Twilight", "bored": "Five Feet Apart", "relaxed": "Pride and Prejudice" }, "sci-fi": { "happy": "The Hitchhiker’s Guide to the Galaxy", "sad": "Flowers for Algernon", "excited": "Ready Player One", "thoughtful": "Dune", "scared": "Jurassic Park", "bored": "Ender's Game", "relaxed": "The War of the Worlds" }, "horror": { "happy": "Coraline", "sad": "Pet Sematary", "excited": "Dracula", "thoughtful": "The Haunting of Hill House", "scared": "It by Stephen King", "bored": "The Call of Cthulhu", "relaxed": "Goosebumps" }, "comedy": { "happy": "Diary of a Wimpy Kid", "sad": "Eleanor Oliphant Is Completely Fine", "excited": "Good Omens", "thoughtful": "The Alchemist", "scared": "The Graveyard Book", "bored": "Big Nate", "relaxed": "The Little Prince" }, "mystery": { "happy": "Nancy Drew", "sad": "The Girl on the Train", "excited": "Sherlock Holmes", "thoughtful": "Gone Girl", "scared": "The Woman in Black", "bored": "The Da Vinci Code", "relaxed": "The Hound of the Baskervilles" }, "fantasy": { "happy": "Harry Potter", "sad": "The Book Thief", "excited": "Percy Jackson", "thoughtful": "The Hobbit", "scared": "Coraline", "bored": "Eragon", "relaxed": "The Chronicles of Narnia" }, "drama": { "happy": "The Alchemist", "sad": "The Kite Runner", "excited": "The Catcher in the Rye", "thoughtful": "To Kill a Mockingbird", "scared": "Lord of the Flies", "bored": "The Great Gatsby", "relaxed": "Anne of Green Gables" }, "thriller": { "happy": "The Firm", "sad": "The Silence of the Lambs", "excited": "Angels & Demons", "thoughtful": "Shutter Island", "scared": "The Girl with the Dragon Tattoo", "bored": "The Da Vinci Code", "relaxed": "The Reversal" }, "adventure": { "happy": "Around the World in 80 Days", "sad": "White Fang", "excited": "The Three Musketeers", "thoughtful": "Journey to the Center of the Earth", "scared": "Jurassic Park", "bored": "Treasure Island", "relaxed": "The Jungle Book" } } } # --------------------------------------------------- # MAIN PROGRAM # --------------------------------------------------- print("Welcome to the AI Movie/Book Recommender System") print("----------------------------------------------------------") name = input("Enter your name: ").strip() choice = input("Would you like a Movie or a Book recommendation? (movie/book): ").lower().strip() genre = input("What genre do you prefer? (action, romance, sci-fi, horror, comedy, mystery, fantasy, drama, thriller, adventure): ").lower().strip() mood = input("What's your current mood? (happy, sad, excited, thoughtful, scared, bored, relaxed): ").lower().strip() print("\nAnalyzing your preferences... Please wait...") time.sleep(1.5) # Ensure always valid output if choice in recommendations: if genre in recommendations[choice]: if mood in recommendations[choice][genre]: result = recommendations[choice][genre][mood] else: # fallback for wrong mood result = list(recommendations[choice][genre].values())[0] else: # fallback for wrong genre first_genre = list(recommendations[choice].keys())[0] result = list(recommendations[choice][first_genre].values())[0] else: # fallback for wrong choice result = "Invalid choice" if not result: # fallback in case of unexpected user input result = list(recommendations[choice][genre].values())[0] print(f"\n{name}, based on your mood and genre, we recommend:\n➡️ {result}") print("\nThank you for using the AI Recommender System. Enjoy your entertainment!")