140k views
4 votes
Assignment 3: Chatbot
What the code for assignment 3: chatbot Edhesive.

Assignment 3: Chatbot What the code for assignment 3: chatbot Edhesive.-example-1
Assignment 3: Chatbot What the code for assignment 3: chatbot Edhesive.-example-1
Assignment 3: Chatbot What the code for assignment 3: chatbot Edhesive.-example-2
User Mhavel
by
6.6k points

2 Answers

3 votes

Coding is difficult but I don't have a chatbot

User Hemen
by
7.2k points
3 votes

Answer:

import random

# Introduction

print("Welcome to the fashion chatbot! I'm here to help you with your fashion preferences.")

# Ask for user's first name

print("What is your first name?")

name = input()

# Ask for user's shoe preference

print("What shoes do you like?")

shoe_preference = input()

# Use if-elif-else statement to respond to user's shoe preference

if shoe_preference == "Converse":

print("Nice, casual is always in!")

elif shoe_preference == "Boots":

print("Cool, boots are a versatile choice.")

else:

print("Great choice!")

# Ask for user's age

print("How old are you?")

age = input()

# Use if-elif-else statement to respond to user's age

if int(age) < 18:

print("It's a great time to start exploring your style!")

elif int(age) < 25:

print("You're at a fun age to experiment with your fashion choices.")

else:

print("It's always a good time to try out new fashion styles!")

# Use a randomly generated number to randomly respond

random_number = random.randint(1, 3)

if random_number == 1:

print("I think I might know your style.")

elif random_number == 2:

print("You have a unique sense of style.")

else:

print("You have great fashion taste.")

# Ask for user's favorite top

print("So, " + name + ", what is your favorite top?")

top_preference = input()

# Use if-elif-else statement to respond to user's top preference

if top_preference == "Graphic Tees":

print("That's a good choice.")

elif top_preference == "Button-up shirts":

print("Classy and sophisticated.")

else:

print("Great choice!")

# Use a randomly generated number to randomly respond

random_number = random.randint(1, 3)

if random_number == 1:

print("Ay that's lit.")

elif random_number == 2:

print("wow, so stylish!")

else:

print("That's in right now.")

# Ask for user's bottom preference

print("I like where this is going.")

print("What about your choice of bottom?")

bottom_preference = input()

# Use if-elif-else statement to respond to user's bottom preference

if bottom_preference == "Jeans":

print("Jeans are a classic choice.")

elif bottom_preference == "Cargo pants":

print("You can't go wrong with those.")

else:

print("Great choice!")

# Ask for user's head accessory preference

print("What about your head accessory?")

head_accessory_preference = input()

# Use if-elif-else statement to respond to user's head accessory preference

if head_accessory_preference == "Beanies":

print("Beanies are fun!")

elif head_accessory_preference == "Baseball hats":

print("Baseball hats are a popular choice.")

else:

print("Unique choice!")

# End conversation

print("Well, " + name + ", it was awesome getting to know your style.")

User ThomasEdwin
by
7.3k points