vendredi 13 septembre 2019

questions about randint and if

def rng():
    return randint(1, 100)

is

if rng() <= x and rng() <= y and rng() <= z:
   .....

The same as is

if rng() <= x and y and z:
   .....

What im trying to do is take a number from the function rng() then use it to compare with the variables inside the if statement

and i'm questioning whether on the first version, the rng() is ran 3 times making it 3 different numbers for each compare and not the same number.

or the second version can work




Aucun commentaire:

Enregistrer un commentaire