Jul-16-2018, 08:42 AM
Hey,
I'm new to Python and programming so won't be of much help but for chosing the option, since you want to match keywords to the name of an option, why not try and use RE (Regular Expressions)? I've found them really useful in my own scripts.
Maybe with something along the lines of:
One other thing that comes to my mind reading your code that I've been told numerous times to do, make your functions reusable. As beginners we often tend to want to cram a lot of things inside one function, we think it's better, faster... But seasoned programmers prefer having one-task functions that call other subfunctions, that makes them reusable in other bits of your code to do something else. I try to think of functions as bricks that shouldn't become entire walls. Of course it depends on the complexity of the program, if you're doing a top-notch thing maybe your "one-task" will be at least 10 functions calls and uses...
All the best, keep up learning!
I'm new to Python and programming so won't be of much help but for chosing the option, since you want to match keywords to the name of an option, why not try and use RE (Regular Expressions)? I've found them really useful in my own scripts.
Maybe with something along the lines of:
re.match(chosen_task, the_string_it_should_match) is not None: #do smth if anything matchesCouldn't help you further with RE since they're a dark spot for me too right now but if you type it into stackoverflow you'll get tons of handy examples.
One other thing that comes to my mind reading your code that I've been told numerous times to do, make your functions reusable. As beginners we often tend to want to cram a lot of things inside one function, we think it's better, faster... But seasoned programmers prefer having one-task functions that call other subfunctions, that makes them reusable in other bits of your code to do something else. I try to think of functions as bricks that shouldn't become entire walls. Of course it depends on the complexity of the program, if you're doing a top-notch thing maybe your "one-task" will be at least 10 functions calls and uses...
All the best, keep up learning!