I have one problem with random functions of python.I don't know which random function will work for this code:
name=['toffla','rebecca','toff','becca']
if (parser.getPayload().lower() == name):
parser.sendGroupMessage(parser.getTargetID(),"what?")
If someone input any name from these 4 names, the output should be "what?".
how to do this?
Thank you in advance!
Please use 'if' with "in" operator. Because "name" is not a string. if input == name: <- always false. Because input == 'toffla' its not list. example:
>>> name = "bugra"
>>> names = ["github","bugra","turkey","developers"]
>>> name == names
False
>>> name in names
True
i hope you know!