What I basically want to do would be: Set a max and a minimum value from the input, but I don't know how to do it.
if lado1>lado2 and lado3:
... print("A=lado1")
...
if lado2>lado1 and lado3:
... print("A=lado2")
...
if lado3>lado1 and lado2:
... print("A=lado3")
How can I create that variable from the if above? Thank you very much in advance!
The most appropriate thing would be after each if, use:
A = ladoQueQuieras
and separate the ifs withelse
so that they are not all executed unnecessarily. At the end, and outside of the ifs, you useprint(A)
.Something like:
Well, basically you would have to first make that entry, which would be
And then, as @FJSevilla says, you would have to get the maximums with the max function and the minimums with the min function , so it would be as follows:
And python returns you the maximum and minimum.
A more extensive form could also be made, which would be with conditionals evaluating all cases, then it would be:
And so on....