Click here to Skip to main content
15,886,422 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
You're tasked to implement a program with a very simple form of artificial intelligence. When the user gives the program a phrase, the program should reply with an appropriate answer. We're not going to make this complex, so the program has a list of definitions associated to specific phrases. Additionally, assume the program is case sensitivity. You can add that as a feature to your program, but it will not be tested (i.e. not scored) nor will any bonus points be given.

To make things a little more fun versus having a program reading from an actual dictionary, our program's domain of knowledge will be related to Arcane, the Netflix series.

Here's a list of phrases and their definitions:

Input: What is Arcane?
Output: Arcane is an animated television series set in the League of Legends universe. The series was unveiled during the League of Legends 10th Anniversary celebrations. It is currently being developed and produced by Riot and animated by Fortiche Productions in Paris, France.

Input: Arcane
Output: Arcane is an animated television series set in the League of Legends universe. The series was unveiled during the League of Legends 10th Anniversary celebrations. It is currently being developed and produced by Riot and animated by Fortiche Productions in Paris, France.

Input: Who voices Caitlyn?
Output: Katie Leung. She also appears in the Harry Potter series.

Any other input and the program should reply with "Sorry, Chuck. I don't quite understand what you're asking for."

What I have tried:

question = 'response'
if question == 'Arcane':
    print('Response: Arcane is an animated television series set in the League of Legends universe. The series was unveiled during the League of Legends 10th Anniversary celebrations. It is currently being developed and produced by Riot and animated by Fortiche Productions in Paris, France.')
    
elif question == 'What is Arcane?':
    print('Response: Arcane is an animated television series set in the League of Legends universe. The series was unveiled during the League of Legends 10th Anniversary celebrations. It is currently being developed and produced by Riot and animated by Fortiche Productions in Paris, France.')
 
elif question == 'Who voices Caitlyn?':
    print('Response: Katie Leung. She also appears in the Harry Potter series.')
Posted
Updated 24-Jan-22 23:22pm

1 solution

Add a loop: Loops - Learn Python - Free Interactive Python Tutorial[^]

You'll probably also want to get some input from the user and provide an "exit" question.
It's polite to prompt the user to enter something, as well (and tell them how to exit).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900