[PYTHON] Create a chatbot program in Python: a program that appears to talk intelligently to a human using text. Your program should involve asking the user questions and having the computer respond in a reasonably intelligent fashion based on those answers. For example, here is a sample chat:
ChatBot: Welcome, I am Chatbot . What is your name?
User: My name is Abby .
ChatBot: Hello Abby. How old are you?
User: 22. <---- Input
ChatBot: That is older than I am! Can you guess my age?
User: 11. <----- Input
Chatbot: That is incorrect. My age is between 5 and 10. Guess again.
User: 4. <----- Input
Chatbot: Correct! What is your favourite animal?
User: Cat. <------ Input
Chatbot: I do not like cats. I prefer dogs.
etc.
You may make your chatbot ask and answer any questions, so long as you include at least the following:
- One if/else statement.
- One if statement using OR.
- One if statement using AND.
- One if statement using both AND and OR.
- At least one loop.
- At least one calculation involving a numerical answer that the user inputted (for example, in the above chat, the chatbot might calculate the difference between its age and the user’s age and output this).
The input only has to be one word or numbers, doesn't have to be a phrase.
Code:
print("\n\n")
print("Chatbot: Welcome, I am Chatbot. What is your name?")
name = input("")
print("\nChatbot: Hello "+name+". How old are you?")
age = int(input(""))
if age >= 5 and age <= 10:
print("We are both of same age! What a coincidence!!")
else:
if age < 5:
print("\nChatbot: You're younger than me! Can you guess my age?")
else:
print("\nChatbot: That is older than I am! Can you guess my age?")
myage = int(input(""))
if myage > 5 or myage < 10:
print("\nChatbot: That is incorrect. My age is between 5 and 10. Guess again.")
myage =int(input(""))
while myage!= 7:
print("\nChatbot: That is incorrect. My age is between 5 and 10. Guess again.")
myage = int(input(""))
print("\nChatbot: That's Correct! Let's play a game, tell me a year and I will tell you if it's a leap year or not");
year = int(input())
if (year%4 == 0 and year%100 != 0) or year%400 == 0:
print("\nChatbot: It's a leap year!")
else:
print("\nChatbot: It's not a leap year")
print("\nChatbot: Give me two numbers a and b!")
a = int(input(""))
b = int(input(""))
print("\nChatbot: If we do a/b then quotient will be "+str(int(a/b))+" and remainder will be "+str(a%b))
print("\n\n")

Output:

[PYTHON] Create a chatbot program in Python: a program that appears to talk intelligently to a...
Hello, I am trying to solve the following problem using python: Assignment 3: Chatbot 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. Here is the scenario: You have decided to start an online website. You are creating a prototype to show investors so you can raise money and launch your website. You should ask the user at least 5...
Python 3 Can anyone make my Python code more readable, by breaking up the code into smaller chunks using functions. If a piece of code tries to do several things, it should be broken up into several different functions. print("chatbot: Hello, I am chatbot. What is your name?") name = input("") print("chatbot: Nice to meet you "+name+". Tell me now, what is your age?") age = int(input("")) if age >= 16 and age <= 25: print("We are the same age!...
IN PYTHON
Exercise 4 Build a single chatbot that takes input from the user and behaves in the following way: 1. If the input is a "I feel [..] statement, the chatbot responds by asking "Why do you feel that way"? 2. If the input is a "Can you [predicate] " question, the chatbot responds by saying "Sure, I can [predicatel all day." 3. If the input is a "Did you [predicatel" question, the chatbot responds by saying "No, I...
Assignment 8.3: Phone Chatbot (10 pts) For this programming assignment, we write a basic chatbot program. For fun, try having a conversation with an online chatbot here or here. Some sources estimate that 25% of customer services will be handled by Chatbots in 2020, vs. 2% in 2017 (1). The chatbot we are designing must ask you the following questions: What is your name? What is your phone number? What is your phone plan? How many GB of data this...
Hello, In Python, I am trying to create a function that will return the domain name from any inputted email address. For example, my input of john@domainname.com would return just the domainname. It needs to be done using regular expressions and the map function. I'm still stuck on trying to get the correct parameters for regular expression and also what is throwing it off. Thank you for your help! I am currently working with a list of different email addresses...
in python
5.23 Login Create a program that prompts the user for a username and password. The correct username should be python and the correct password should be csci 135. See below for example output. (Different messages depending on if user name or password are correct.) Only allow the user to make 3 attempts. Welcome to my secret program! Please enter your username: Trish Please enter your password: Duce Invalid username and password Please enter your username: Trish Please enter...
Can someone please rewrite this code using a while loop? Please write it in python. #The winning number my_number = 12 #variable for the input name user_n = input("Hello! What is your name?") #Ask the user print("Well",user_n,": I am thinking of a number between 1 and 20." + "Take a guess.") user_n = float(input("Take a guess.")) #if statements if user_n == my_number: print("Good job" ,user_n, "You guessed my number!") if user_n > my_number: print("Your guess is high. You lose.") if...
Write a python program that stores a random number from 0-99 in a variable named target (this part is provided). Note that target will not be further updated in the program. The program then accepts user input and stores it in a variable named guess. You may assume that the user only enters integers. The program ends when guess is equal to target otherwise the program continuously asks the user to provide a guess. Output Correct after x trial! when...
Create a program that will ask for the name, age, address, and
favorite food of the user. After which, create a calculator with
ADD, SUB, MULTI, and DIV. Then the program will display all the
user have inputted in bash program
ACTIVITY 4: Create a program that will ask for the name, age, address, and favorite food of the user. After which create a calculator with ADD, SUB, MULTI, and DIV. Then the program will display all the user have...
Overview Module 3 Assignment 1 features the design of a pseudocode and a Python program that uses iteration to guess a number from 1 to 10. Each lab asks you to write pseudocode that plans the program’s logic before you write the program in Python and to turn in three things: 1) the pseudocode, 2) a screenshot of the output, and 3) the Python program. Instructions Write pseudocode for a Python program that uses iteration to guess a number from...