Exercize to understand from three numbers which is more high

^Bart gabriele1NOSPAM at hotmail.com
Sun Jan 27 05:37:08 EST 2019


>    You need to do this exercize just by using if, elif and else,
>    but in the quotation above, you use "=".

We can use > < and =

Now I wrote:

number1 = int( input("Insert the first number: "))

number2 = int( input("Insert the second number: "))

number3 = int( input("Insert the third number: "))

numbermax = number1

numbermiddle = number2

numbermin = number3

if number2 > number1 and number2 > number3 and number3 < number2 and 
number3 < number1:
     numbermin = number3
     numbermax = number2
     numbermiddle = number1

     print("Number max is: ",numbermax, "Number middle is: 
",numbermiddle,"Number min is: ", numbermin)

if number2 < number1 and number2 < number3 and number3 > number2 and 
number3 > number1:
     numbermin = number2
     numbermax = number3
     numbermiddle = number1

     print("Number max is: ",numbermax, "Number middle is: 
",numbermiddle,"Number min is: ", numbermin)

else:

     print("Number max is: ",number1, "Number middle is: 
",number2,"Number min is: ", number3)

But it doesn't work... :\



More information about the Python-list mailing list