How to fix a Python elif? -


okay have below code performing don't want do. if run program ask "how you?" (obviously), when give answer question applies elif statement, still if statement response. why this?

talk = raw_input("how you?") if "good" or "fine" in talk:      print "glad here it..." elif "bad" or "sad" or "terrible" in talk:      print "i'm sorry hear that!" 

the problem or operator not want here. you're saying if value of "good" true or "fine" in talk. value of "good" true, since it's non-empty string, why branch gets executed.


Comments

Popular posts from this blog

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

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

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