111k views
4 votes
A chatbot is a computer program designed to emulate human conversation. For this program, you will use if statements, user input, and random numbers to create a basic chatbot.

The Scenario
You have decided to start a website and are creating a chatbot prototype to show investors so you can raise money and launch your website.

Your chatbot should ask the user the following (minimum requirements for the grader) and then give answers depending on the answers the user inputs:

at least 5 questions
at least 2 if-elif-else statements
the use of the random module and randomly generated numbers
Based on these criteria, some responses will be based on what the user types and some will be based on random numbers.

For example, if the chatbot asks how the user is doing, your chatbot might respond I’m sorry to hear that. in response to a user input of sad, or That's great! in response to a user input of happy.

Additionally, you could also have a random number generated between, say, 1 and 3 and have a corresponding response depending on the number to randomly answer with That is great to hear. or So interesting., and so on.

Sample Run
Please note that due to the infinite possibility of questions that can be asked, your program will be different—this is only one example.

What is your first name?

Pascal

What is your last name?

Smith

Hi there, Pascal Smith, nice to meet you!


How old are you?

17

17 is a good age.

You are old enough to drive.


So, Pascal, how are you today?

Happy

You are happy.

That is good to hear.

Tell me more.


I am just happy.

That's good to hear.


Well, Pascal, it has been nice chatting with you.

1 Answer

3 votes

Final answer:

The student's task requires programming a chatbot that simulates human conversation using if statements, user input, and the random module to create dynamic and varied responses. The chatbot is part of a prototype designed to attract investors for a new website, paralleling how a computer program's actions are influenced by its input history.

Step-by-step explanation:

Creating a chatbot involves programming a computer program to mimic human conversation. Using a combination of if statements, user input, and the random module, you can design a basic chatbot for a range of purposes. In the educational scenario provided, the student's task is to create a prototype chatbot for a website that is intended to impress investors.

The program should meet minimum requirements, such as asking a minimum of five questions and using at least two if-elif-else statements to determine the output based on user inputs. Additionally, the inclusion of the random module allows for responses that are not entirely predictable, adding variation to the chatbot's interactions.

The process of creating such a chatbot is akin to the way an individual's behavior is determined by their genetic make-up and experiences; similarly, what a computer program does next is based on its input history and programmed responses.

User Hayes Haugen
by
5.9k points