Skip to content
How do I randomize responses?
Profile icon

Is there a way to give a bot a short list in the code so it can generate out one of a few responses? If someone types in p.h, the bot could respond with hi, hello, or hey. I've so far only seen tutorials that use APIs for random generation, but I don't need anything like that.

You are viewing a single comment. View All
Profile icon
from random import choice print(choice(responses))

all you need to do is put in a different list for the different types of responses and ur good