mercredi 10 octobre 2018

How to select random key with common values?

so I'm trying to create an AI just for fun, but I've run into a problem. Currently when you say Hi it will say Hi back. If you say something it doesn't know, like Hello, it will ask you to define it, and then add it to a dictionary variable knowledge. Then whenever you say Hello, it translates it into Hi and will say Hi.

But, I want it to loop through what you've defined as hi and say a random thing that means hi. So if you tell it Hello, What's Up, and Greetings all mean hi, it will work to say any of them and it will return Hi. But how would I make it say either Hi, Hello, What's Up, or Greetings once it knows them? (just examples)




Aucun commentaire:

Enregistrer un commentaire