KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm learning Python and I'm having a little bit of a problem. Came up with this short script after seeing something similar in a course I'm taking. I've used "or" with "if" before with success (it doesn't show much here). For some reason I can't seem to get this working: test = raw_input("It's the flying circus! Cool animals but which is the best?") x = test.lower() if x == "monkey" or "monkeys": print "You're right, they are awesome!!" elif x != "monkey" or "monkeys": print "I'm sorry, you're incorrect.", x[0].upper() + x[1:], "is not the right animal." But this works great: test = raw_input("It's the flying circus! Cool animals but which is the best?") x = test.lower() if x == "monkey": print "You're right, they are awesome!!" elif x != "monkey": print "I'm sorry, you're incorrect.", x[0].upper() + x[1:], "is not the right animal." Probably the or conditional does not fit here. But I've tried and, etc. I'd love a way to make this accept monkey or monkeys and everything else triggers the elif.
Tags (comma-separated)
Save Edits
Cancel