Python Classroom image

Anil  Bist / Professional / Web Technology
To post your Question Join Classroom
small chat bot

Found a little code that is supposed to be a simple chatbot AI. It is random, except that the only time it randomly chooses from the list is when the program is run again (not while True). The random choice I chose when I first ran the program is the one it will keep choosing until I run the program again. What would be the fix?

import random

greetings = ['hola', 'hello', 'hi', 'Hi', 'hey!','hey']
random_greeting = random.choice(greetings)

question = ['How are you?','How are you doing?']
responses = ['Okay',"I'm fine"]
random_response = random.choice(responses)

while True:
	userInput = raw_input(">>> ")
	if userInput in greetings:
	elif userInput in question:
		print("I did not understand what you said")
Anil  Bist

Skills    Python

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,

in 2006, i Join a web development company in Bangalore and start work on "Ruby on Rail" this is my first web development framework and we worked in this framework and develop four to five project after some time , I moved to JEE/Sturst frame work,

After some time i decided that now times come and I have to go on in my own way and I started a company name is "Soarlogic&q


  Students (0)