Way to determine if X and Y are both over 0

前端 未结 2 1800
隐瞒了意图╮
隐瞒了意图╮ 2021-01-29 10:41

I was wondering if there was a way of telling if two numbers were both above 0. I was thinking of using an elif statement but I wasn\'t sure if that would work.

2条回答
  •  一整个雨季
    2021-01-29 11:03

    Use boolean operators to test more than one condition, here the and operator does what you want:

    if x > 0 and y > 0:
        # x and y are both over 0.
    

提交回复
热议问题