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? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -