lundi 15 janvier 2018

Elegant way to check if multiple variables are bigger than 0

I have multiple variables in Python 3, that are assigned with 0 later they will get new different values from SQL Queries. I want to check if all of this variables are bigger than 0. My code

var1 = 0
var2 = 0
var3 = 0
...
...
if (var1 > 0 and var2 > 0 and var3 > 0 ):
     do something

is there a more elegant way to solve this?

Aucun commentaire:

Enregistrer un commentaire