mercredi 6 mai 2020

How to compare two parameters with "as long as" [closed]

I have two parameters:

x = a * b * c
Y = m * n * o

I want the value of Y to be used as long as it's greater than X.

I tried an if-else statement:

if Y>X: 
      Y = m * n * o
else:
      Y = X

But as Y can't be defined before starting the if-else loop, the program fails at the very first step (i.e. Y>X).

Error: Y is not defined

How do I define Y such that I don't get the error?

Aucun commentaire:

Enregistrer un commentaire