Exercize to understand from three numbers which is more high

Jack Dangler tdldev at gmail.com
Tue Jan 29 10:30:47 EST 2019


On 1/27/19 7:34 AM, Frank Millman wrote:
> "^Bart" wrote in message news:q2k1kk$1anf$1 at gioia.aioe.org...
>>
>> >    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: "))
>>
>
> [snip stuff that doesn’t work]
>
>>
>> But it doesn't work... :\
>>
>
> You have got to a starting point - you have three numbers. Good.
>
> Where do you do go from here?
>
> I would start with two of the numbers, and work out which one is higher.
>
> Once you know that, you can compare that one with the third number, 
> and work out which one is higher.
>
> From that, you can work out which one is the highest of all three.
>
> Then you can apply the same logic to work out which is the lowest.
>
> Give that a go, and come back here if you get stuck.
>
> Frank Millman
>
>
> Frank - The OP didn't appear to need to 'sort' the inputs, but only to 
> solve for the highest value of the three using limited arithmetic 
> operators. I like your text walkthrough. It should give the OP enough 
> to go on. I only supplied a linear solution because I am not sure why 
> this would be a struggle.



More information about the Python-list mailing list