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
Post a Comment