Exercize to understand from three numbers which is more high
^Bart
gabriele1NOSPAM at hotmail.com
Sun Jan 27 05:19:54 EST 2019
> In my experience based on decades of writing programs...
>
> 1. The assignment/exercise/problem should be a write a function with a
> particular signature. So first decide on the signature.
>
> def max3(n1, n2, n3):
> "Return the max of the three inputs."
> return None # To be replaced.
I need to do this exercize just by using if, elif and else, in the next
lesson we'll discuss other kind of rules! :)
So I need to insert three int numbers and I should show which is the
high, the middle and the min.
# Exercize 305
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:
numbermax = number2
if number3 < number2 and number3 < number1:
numbermin = number3
else:
numbermiddle is number1
print("Number max is: ",numbermax, "Number middle is;
",numbermiddle,"Number min is: ", numbermin)
if number2 < number1 and number2 < number3:
numbermin = number2
if number3 > number2 and number3 > number1:
numbermax = number3
else:
numbermiddle is number2
print("Number min is: ",numbermin)
I don't understand how could I fix it :\
More information about the Python-list
mailing list