Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Help with phd kitty level


I cant seem to figure out what is wrong with my code, hep would be appreciated.

Kitty is the smartest cougar. It knows everything.

Let’s make a show for those peasants.

This function makes the pet say something like: “Miao”

def sayTwoWords(event):
# Make the pet say the correct answer to the questions.

Use ‘sayTwoWords’ for the pet’s “hear” event.

pet.on(“hear”, sayTwoWords)

Now relax and watch the show.

hero.say(“One plus one is…?”)
hero.say(“x^3 - 6x^2 + 12x - 8 = 0. What is x…?”)
hero.say(“How many moons does Mars have…?”)


I think the code must be pet.say("two") or pet.say("2") but not pet.say("Two."), you have two mistakes:

  • Capital T
  • Dot . in the end of the word two.


Thank you very much, everything works now, feel kinda silly now for making such a mistake. :slight_smile:


@Azab_Bakov Well its not really a mistake. I wonder if we can improve the message detection for the level.

@Bryukh if we use something like w.replace /[^0-9a-z]/gi, '' on the string after w.toLowerCase() should that strip out the characters like . ' ; ? ! etc?


I just submitted a patch for the Phd Kitty level so that it will allow for periods in a phrase like “Two.” If my code is ok then perhaps we could see an update.



Patched. Thank you very much! I missed this post yesterday and I saw it only today.