Hey, y’all!
I don’t know what I have done but certainly something not right heh heh… Here is a screenshot:
(This is the only part where I have done some editing, and it says something was wrong…

Hey, y’all!
I don’t know what I have done but certainly something not right heh heh… Here is a screenshot:
import re
import random
class AlienBot:
# potential negative responses
negative_responses = ("no", "nope", "nah", "naw", "not a chance", "sorry")
# keywords for exiting the conversation
exit_commands = ("quit", "pause", "exit", "goodbye", "bye", "later")
# random starter questions
random_questions = (
"Why are you here? ",
"Are there many humans like you? ",
"What do you consume for sustenance? ",
"Is there intelligent life on this planet? ",
"Does Earth have a leader? ",
"What planets have you visited? ",
"What technology do you have on this planet? "
)
def __init__(self):
self.alienbabble = {'describe_planet_intent': r'',
'answer_why_intent': r'',
'cubed_intent': r''
}
# Define .greet() below:
def greet(self):
self.name = input("hellow there, what's your name?")
will_help = self.name
print(f"Hi {will_help}, I'm Etcetera. I'm not from this planet. Will you help me learn about your planet?")
if will_help in self.nagative_responses:
print("Ok, have a nice Earth day!")
return
self.chat()
# Define .make_exit() here:
def make_exit(self, reply):
for words in self.exit_commands:
if exit_commands in reply:
print("Ok, have a nice Earth Day!")
return True
# Define .chat() next:
def chat(self):
reply = input(random.choice(self.random_questions)).lower()
while not self.make_exit(reply):
reply = input("How are you?")
# Define .match_reply() below:
def match_reply(self, reply):
pass
# Define .describe_planet_intent():
def describe_planet_intent(self):
return "Inside .describe_planet_intent()"
# Define .answer_why_intent():
def answer_why_intent(self):
return "Inside .answer_why_intent()"
# Define .cubed_intent():
def cubed_intent(self, number):
return "Inside .cubed_intent()"
# Define .no_match_intent():
def no_match_intent(self):
return "Inside .no_match_intent()"
# Create an instance of AlienBot below:
my_bot = AlienBot()
my_bot.greet()
Does this work for you?
Thanks again for helping!
It seems like a simple typo, double check where you’ve attempted to access an object attribute (probably with dot notation) and make sure the attribute you used matches those that exist.
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.