python - Fixing an Or Statement With Variables -


how change below code python reads list inside 2 variables , perform action after without reeving error? code:

bad = ['bad','terrible', 'dumb'] = ['good','happy','awesome'] talk = raw_input("type:") if (bad) in talk:      print "i'm sorry hear :(" elif (good) in talk:      print "that's good!" 

try this:

bad = set(['bad','terrible', 'dumb']) = set(['good','happy','awesome']) talk = raw_input("type:") if bad & set(talk.lower().split()):      print "i'm sorry hear :(" elif & set(talk.lower().split()):      print "that's good!" 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

c++ - How to modify context menu of internet explorer using IDocHostUIHandler::ShowContextMenu? -

c# - Asterisk click to call -