Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
2

[python] Can someone explain how if statements with multiple conditions work?

xolyon
xolyon

Basically I have been working on a piece of code for example

while x > 0 or y < 100: print(something) print(y,x)

And the output would be something like this 190 , 0

Which is really annoying as it's only following one condition , I tried this with if statements and I got the same thing.

Can explain these multiple Condition concepts to me?

3 years ago
You are viewing a single comment. View All
1
xolyon
xolyon

@CaptainAnon
ok in a nutshell and OR is basically if one condition is True you it outputs true and in the case of my loop it should end it

However when I try to run my code it only tried to meet the first condition and completely ignored the second one and the OR (so for example the X would reach 0 but the y would already be at like 200) and I don't get what's the problem here and how to fix it

3 years ago