Is there an operation for not less than or not greater than in python?

后端 未结 4 1349
无人共我
无人共我 2021-01-13 16:07

Consider a following snippet:

a = 0
if a == 0 or a > 0:
    print(a)

Essentially, I want to do something when a is not nega

4条回答
  •  温柔的废话
    2021-01-13 16:45

    Instead of a == 0 or a > 0 you could just use a >= 0.

    https://docs.python.org/library/stdtypes.html#comparisons

提交回复
热议问题