PHD KITTY stuck


#1

Help I can only make the cat answer the first and third question. What is wrong with my code? Thank you for your help.

def YOmama(event):
    # Make the pet say the correct answer to the questions.
    pet.say("two")
    pet.say("pug life")
    pet.say("ultimate pug life")
    pass

# Use 'sayTwoWords' for the pet's "hear" event.
pet.on("hear", YOmama)
# Now relax and watch the show.
hero.say("One plus one is...?")
hero.say("WHat is your life")
hero.say("You down")

#2

For each hero questions, pet should answer once. Instead your pet answer three times when to hear something, as the result it say three answers before your hero ask three questions.


#3

I understand your point. How do i make the pet wait for the next question before answering?


#4

You can try 3 functions
1 per answer
Or go with 1 answer for all question
pet.on works after activation in parallel
throughout the whole code execution time

Answer must be
2
"two"
“2 words”


#5

You don’t need to wait. It should answer once for each question. Three questions - three answers. Each hero’s “say” triggers “hear” event for the pet.


#6

Do you want to show how to possible to solve it another way? That function can trigger “infinite say-say” :slight_smile:


#7

thank you for the help:) .
I already figure it out