threw this together, let me know what you think
num_list=[] name_list = ['first','second','third','fourth','fifth','sixth','seventh','eighth','ninth','tenth'] name_it = name_list.pop(0) while len(num_list) < 3: try: num_list.append( int( input(f"Insert the {name_it} number: "))) except ValueError: print('Not a number, try again!') else: name_it = name_list.pop(0) print(f"Max number is: {sorted(num_list)[-1]}") On Mon, Jan 28, 2019 at 1:58 AM Frank Millman <fr...@chagford.com> wrote: > "^Bart" wrote in message news:q2mghh$ah6$1...@gioia.aioe.org... > > > > > 1. The last two lines appear to be indented under the 'if number3 < ' > > > line. I think you want them to be unindented so that they run every > > > time. > > > > I'm sorry but I didn't completely understand what you wrote about the > last > > two lines, please could you write how my code could be fixed? > > > > The last four lines of your program look like this - > > if number3 < number2 and number3 < number1: > numbermin = number3 > > print("Number min is: ",numbermin) > > numbermiddle = (number1+number2+number3)-(numbermax+numbermin) > > print("Number middle is: ",numbermiddle) > > The last three lines all fall under the 'if number3 < number2' line, so > they > will only be executed if that line evaluates to True. > > I think that you want the last two lines to be executed every time. If so, > they should be lined up underneath the 'if', not the 'print'. > > > > > > if a == 1: > > > do something > > > elif a == 2: > > > do something else > > > > Finally I understood the differences between if and elif! Lol! :D > > > > It is actually short for 'else if', but I guess it is not obvious if you > have not seen it before! > > Frank > > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list