Skip to content

Instantly share code, notes, and snippets.

@infrony
Created December 21, 2017 13:01
Show Gist options
  • Save infrony/9f68c8ea8699b1093a27f82392a4a534 to your computer and use it in GitHub Desktop.
Save infrony/9f68c8ea8699b1093a27f82392a4a534 to your computer and use it in GitHub Desktop.
Simple Chatbot with python
import random
greetings = ['hola', 'hello', 'hi', 'Hi', 'hey!','hey']
random_greeting = random.choice(greetings)
question = ['Cómo estas?','Como estas?']
responses = ['Gracias',"Estoy Bien"]
random_response = random.choice(responses)
while True:
userInput = input("Ingrese un saludo o una pregunta del arreglo:")
if userInput in greetings:
print(random_greeting)
elif userInput in question:
print(random_response)
else:
print("No entiendo lo que me estas pidiendo")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment