If I wanted to say something for a while loop such as: while time is greater than or equal to 0, would it simply be written as while time > or == 0? Or is there no way to do this?
asked Dec 15, 2013 at 5:51
user2789945
5652 gold badges7 silver badges23 bronze badges
3 Answers 3
Use while time >= 0 (equivalent to while time > 0 or time == 0)
>>> 0 >= 0
True
>>> 1 >= 0
True
>>> -1 >= 0
False
answered Dec 15, 2013 at 5:53
falsetru
371k69 gold badges770 silver badges660 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
It would be:
while time >= 0:
pass
#here be dragons
answered Dec 15, 2013 at 5:52
Hyperboreus
32.6k9 gold badges50 silver badges89 bronze badges
Comments
Counting in Python example:
time = 0
while time < 100:
time = time + 1
print time
Comments
lang-py
oris involved in the translation to Python. In mathematics, this "greater than or equal" relationship is written with the symbol ≥, but usually in programming languages, and certainly in Python, it's written>=.