Exercize to understand from three numbers which is more high

MRAB python at mrabarnett.plus.com
Tue Jan 29 13:40:16 EST 2019


On 2019-01-29 16:02, Dan Sommers wrote:
> On 1/29/19 9:27 AM, Jack Dangler wrote:
> 
>> wow. Seems like a lot going on. You have 3 ints and need to determine 
>> the max? Doesn't this work?
>> 
>> N1, N2, N3
>> 
>> if N1>N2
>>    if N1>N3
>>      MaxNum = N1
>> elif N2>N3
>>    MaxNum = N2
>> elif N1<N3
>>    MaxNum = N3
> 
> No.  Assuing that you meant to include colons where I think
> you did, what if (N1, N2, N3) == (5, 4, 6)?
> 
And it's still longer and more complicated than it needs to be.



More information about the Python-list mailing list