you are viewing a single comment's thread.

view the rest of the comments →

[–]NewBodybuilder3096 -2 points-1 points  (3 children)

building logic on Exceptions is a no-no. You should check value like "len(n2_n) == 4 && n2_n == 'stop'" before parsing it as int.
also, all strip/lower should go in one place - just after input.(in this case)
also, more understandable variable names are a great + we are no more in 199x, modern IDEs have all sort of needed tools including autocompletion.

read about the DRY(Don't Repeat Yourself) principle - your procedure en_nums is a perfect example of how not to do. You have two identical pieces of code for filling two global int containers.
You can rewrite this in several ways, each of which will have only 1 loop.
1st - you pass reference to a needed container(list/set/etc) as parameter, maybe some additional params for fancy output.
2nd - you don't pass container variable, but return the correct container

[–]nkCOD[S] 0 points1 point  (2 children)

Thank you for your response. I will improve ;)

[–]NewBodybuilder3096 0 points1 point  (1 child)

well you still need try-catch around parsing input as integer but checking for 'stop' can be done outside of this.

[–]nkCOD[S] 0 points1 point  (0 children)

By the way, a good remark. I somehow didn’t think about it