Question

In: Computer Science

write code in python and test Conversation with an AI ChatBot Learning Outcomes: Use the print()...

write code in python and test

Conversation with an AI ChatBot


Learning Outcomes:


Use the print() function to output a variety of data


Use the input() function to ask for multiple data types


Use basic arithmetic operations in a program


Use string methods and operations


Use if/else if/else statements to determine the flow of the program


Comment your code


Debug your code


Test your code


Scenario


A new marketing company is launching an Artificial Intelligence (AI) ChatBot for their website and want you to code a prototype demonstration for their investors. Simulate a "sales conversation" with a customer who will be purchasing licenses for your ChatBot service.

Your code must do the following:


Ask for the customer's first and last name. Store the values input to a variable.


Greet your customer using their full name.


Provide a few sentence overview of your Chatbot program. Be creative - make some stuff up. Output it to the screen with a nice format of your choice. Make this as serious or as silly a scenario as you want it to be.


Ask if your customer would like to make a purchase.


If yes -- continue to the following items:

Ask for their email address. Store the values input to a variable.


Ask for their phone number. Store the values input to a variable.


Ask for how many chatbot licenses they would like to purchase. Store the values input to a variable.


Ask if they would also like to purchase an optional Gold Support plan that gets them priority support.

The Gold Support plan costs $500/year for license purchases 1 - 50.


The Gold Support plan costs $350/year for license purchases 51 - 100.


The Gold Support plan costs $250/year for license purchases 100+.


Each chatbot license costs $75. Calculate and display their current total. Store the values input to a variable.


Apply 10% tax for the total bill.


Calculate the total amount due. Store the values input to a variable.


Ask for a credit card number. Store the values input to a variable.


Ask for a credit card expiration date. Store the values input to a variable.


Ask for a CVC number on the back of the credit card. Store the values input to a variable.


Ask for a zip code. Store the values input to a variable.


Output a receipt using all of the variables you have input. Be sure to show the total license number, the amount for each license, the subtotal, tax, and total amount due.


In the receipt output, include the customer's name, phone number, email address, the credit card number, and expiration date.  


If no - thank the customer by name and say goodbye.


Ask the customer if they would like to restart the ChatBot.

For advanced coders extra


If you want an extra challenge, modify the scenario above with THREE different ChatBot service plans (instead of only the $75.00 version). Perhaps have a LITE, STANDARD, and ADVANCED ChatBot plan. Ask the user how many of each service plans they would like to purchase and calculate the totals based on the price of each plan.

(write code in python and test )

Solutions

Expert Solution

// Python programm for above question

print("Please let me know your name:")             // Asking customer's name

Fname = input("First name: ")                          //Taking first name as input
Lname = input("Last name: ")                          //Taking last name as input
print(" Welcome to chatbot service", Fname, Lname) // printing first name and last name
print("We provide chatbot service for your business and personal purpose. Now do not worry , if you are busy or you are out of station. We are there for you with our chatbot service")

//Describing about chatbot service
print("Would you like to make purchase, If yes please enter '1'") // Asking for decision
ask = int(input("Enter your decision: ")) // taking decision as input
if ask==1:                                                  // checking customer decision
    Email = input("Please enter your Email: ") //asking for email, phone and number of chatbot to add
    Phone = input("Please enter your Phone number: ")
    val = int(input("Number of chatbot you want to purchase: "))
    print("would you like to purchase other plans\n The Gold Support plan costs $500/year for license purchases 1 - 50.\n The Gold Support plan costs $350/year for license purchases 51 - 100, \n The Gold Support plan costs $250/year for license purchases 100+")
// providin other offers
    cost = 75    // cost per license
    currtotal = val*75 // calculating total price
    print("Current price: $", currtotal) //printing price without tax
    tax = currtotal*0.1 // calculating 10% tax
    total = currtotal+tax // calculating price including taxes
    print("Total price: $", total) // printing total price

   //asking for credit card and other personal details
    cc= int(input("Enter credit card number: "))
    exp = int(input("Enter expiry date of your card: "))
    cvc = int(input("Enter CVC: "))
    zip = int(input("Enter ZIP code: "))

   //producing reciept
    print("Reciept")
    print("Total license number: ", val)
    print("Price of each license: $", cost)
    print("Sub Total: $", currtotal)
    print("TAX: $", tax)
    print("Total: $", total)
  
// generating reciept for customer
    print("Reciept output")
    print("Name: ", Fname, Lname)
    print("Phone number: ", Phone)
    print("Email: ", Email)
    print("Credit Card number", cc)
    print("CC expiry date", exp)
else:
    print("Thank you, Good bye ", Fname, Lname)
// customer said No hence this
print("would you like to restart chatbot?") // asking for restart

NOTE: Here I have used // to comment the code but in python language '''..................''' is used to comment the code.


Related Solutions

Important: please use python. Using while loop, write python code to print the times table (from...
Important: please use python. Using while loop, write python code to print the times table (from 0 to 20, incremented by 2) for number 5. Add asterisks (****) so the output looks exactly as shown below.   Please send the code and the output of the program. ****************************************************************** This Program Shows Times Table for Number 5 (from 0 to 20) Incremented by 2 * ****************************************************************** 0 x 5 = 0 2 x 5 = 10 4 x 5 = 20 6...
#python #code #AP class #Tech write a function code script which will print out number pyramid...
#python #code #AP class #Tech write a function code script which will print out number pyramid in the form of * so the output will be made up of **** resting on top of each other to form a pyramid shape. Bottom layer should be made of 5 multiplication signs like ***** then next 4 multiplication signs and so on. Top part should have only one *
Given two lists, write python code to print “True” if the two lists have at least...
Given two lists, write python code to print “True” if the two lists have at least one common element. For example, x = [1,2,3], y=[3,4,5], then the program should print “True” since there is a common element 3.
Use python programming to write this code and provide a screen short for the code. 2....
Use python programming to write this code and provide a screen short for the code. 2. Write a function that takes one argument (a string) and returns a string consisting of the single character from that string with the largest value. Your function should contain a for loop. You can assume that the input to your function will always be a valid string consisting of at least one character. You can assume that the string will consist only of lower-case...
(Python) This is my code for printing a roster for a team. When I print to...
(Python) This is my code for printing a roster for a team. When I print to the console, it makes the first player's name show up as number 2, and it says [] (its just blank for 1). How can I fix that so the first player's name is 1, not skipping 1 and going to 2. def file_to_dictionary(rosterFile): myDictionary={} myDict=[]    with open(rosterFile,'r') as f: for line in f:    (num,first,last,position)=line.split() myDictionary[num]= myDict myDict=[first, last, position] print (myDictionary) return...
Use your webcam and record a movie, write a motion detection code and print the message...
Use your webcam and record a movie, write a motion detection code and print the message "Motion Detected" on the original frame. Try to make a better visualization by using different masking. ---using Numpy and opencv
When doing Machine Learning and Deep Learning (AI) research which language is better to use Java...
When doing Machine Learning and Deep Learning (AI) research which language is better to use Java or Python? When would you use Java and when would you use Python?
Please write a python code for the following. Use dictionaries and list comprehensions to implement the...
Please write a python code for the following. Use dictionaries and list comprehensions to implement the functions defined below. You are expected to re-use these functions in implementing other functions in the file. Include a triple-quoted string at the bottom displaying your output. Here is the starter outline for the homework: a. def count_character(text, char): """ Count the number of times a character occurs in some text. Do not use the count() method. """ return 0 b. def count_sentences(text): """...
Please write a python code for the following. Use dictionaries and list comprehensions to implement the...
Please write a python code for the following. Use dictionaries and list comprehensions to implement the functions defined below. You are expected to re-use these functions in implementing other functions in the file. Include a triple-quoted string at the bottom displaying your output. Here is the starter outline for the homework: g. def big_words(text, min_length=10): """ Return a list of big words whose length is at least min_length """ return [] h. def common_words(text, min_frequency=10): """ Return words occurring at...
Using pseudocode or C++ code, write code to print “small” if the magnitude M of an...
Using pseudocode or C++ code, write code to print “small” if the magnitude M of an earthquake is in the range [0, 3), “medium” if M is in the range [3, 6), “large” if M is in the range [6, 9) and “epic” if M is greater than or equal to 9, where M is input by a user via the keyboard. (in c++)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT