Like this? num_max = 0 num_index = 0 name_list = ['first','second','third','fourth','fifth','sixth','seventh','eighth','ninth','tenth'] name_it = name_list.pop(0)
while num_index <3: try: num_list = int( input(f"Insert the {name_it} number: ")) except ValueError: print('Not a number, try again!') else: num_index += 1 if num_list > num_max: num_max = num_list name_it = name_list.pop(0) print(f"Max number is: {num_max}") On Tue, Jan 29, 2019 at 1:26 PM Chris Angelico <ros...@gmail.com> wrote: > On Wed, Jan 30, 2019 at 8:20 AM Bob van der Poel <b...@mellowood.ca> wrote: > > Isn't the easiest way to do this is: > > > > sorted( [n1,n2,n3] )[-1] > > > > to get the largest value? > > >>> help(max) > > But the point of this exercise is not to use sorted() or max(). > > ChrisA > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list