The following code snippet works..
from some_py_file import Thing #I'm still shaky relying on functools' partial function so for this portion I'm writing out code in 'bulk' style code = Thing() some_num = 100 while True: question = input('[yes/no]') if question =='yes' or 'y': try: num = float(input('Enter num...')) if num ==4 or num == '': num = float(some_num /4) if num ==5: num =float(some_num /5) if amount_down == 5: num = float(some_num/20) num2 = float(input('')) print('some_num: ',some_num,' num: ',num)#just to make sure loop reaches here, with question = 'yes' code.func_in_Thing(num, num2) break except ValueError: print('please enter numbers...') continueSo the above works...the opposite should also work...but does not.
from some_py_file import Thing code = Thing() some_num = 100 while True: question = input('[yes/no]') if question =='no' or 'n': break:#this should kick me out of the while loop ALTOGETHER if question != 'no/n' #if question =='foo' it should move the code try/except #BUT question =='foo' just kicks me out altogether. try: num = float(input('Enter num...')) if num ==4 or num == '': num = float(some_num /4) if num ==5: num =float(some_num /5) if amount_down == 5: num = float(some_num/20) num2 = float(input('')) print('some_num: ',some_num,' num: ',num) code.func_in_Thing(num, num2) break except ValueError: print('please enter numbers...') continueThe way I understand
break
it should kick me out of the while ONLY when question == 'no/n'...so why is it the first snippet operates properly and this one breaks regardless of question == 'foo'. if question !='no/n' python SHOULD move down to the try/except code....why doesn't it?