Skip to content
Permalink
Browse files
Uploaded and added comments.
  • Loading branch information
gorausa committed Nov 29, 2018
1 parent 62bfb90 commit 2a707068c68b297accede6cf52c239645a5bdaef
Showing 1 changed file with 26 additions and 0 deletions.
26 why.py
@@ -0,0 +1,26 @@
import random
answer = ["Is it how your friends call you?", "Is it how your mom call you?", "It is just your opinion"]
words_ans = ("To be better than you", "To beat you", "To make silly conversations")

'''Function to get ChatBot information related to "why?" questions. Giving particular answer to a user depends on the keyword which he used after "why."'''
def sentence_why(sentence):
if "why" in sentence:
if "stupid" in sentence:
print (random.choice(answer))
elif 'made' in sentence or 'create' in sentence or 'build' in sentence or 'exist' in sentence:
print(random.choice(words_ans))
elif "answer" in sentence:
print("I don't know the answer, because I am still learning.")
elif "don't know" in sentence:
print("Because I am still learning.")
elif "dumb" in sentence:
print("Is it how your friends call you?")
elif "ask" in sentence:
print("Because I am curious and I wanna know.")
elif "sky is blue" in sentence:
print( "A clear cloudless day-time sky is blue because molecules in the air\n scatter blue light from the sun more than they scatter red light.\n When we look towards the sun at sunset, we see red and orange colours\n because the blue light has been scattered out and away from the line of sight.")
else:
print("I am not sure if I understand what you mean.")



0 comments on commit 2a70706

Please sign in to comment.