Explanation: 5 > 4 so it goes into the first if. 5 is not greater than 6, so it does not assign N1 to MaxNum. The elif (because of the lack of indent) applies to the first if, so nothing further is executed. Nothing has been assigned to MaxNum, so that variable does not exist. You're right, it does not work.
How about this: Mylist = [ N1, N2, N3] Maxnum = N1 for value in Mylist: if value > Maxnum: Maxnum = value print(Maxnum) Or were lists and for loops excluded from this exercise? --- Joe S. 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)? -- https://mail.python.org/mailman/listinfo/python-list