Basic validation

Note that many of these arguments that we defined are required. However, there are some arguments that are dependent on each other, for example, the arguments --value and --to. You cannot try to convert a value without specifying the currency that you want to convert to and vice versa.

Another problem here is that, since many arguments are required, if we run the application without passing any argument at all, it will just accept it and crash; the right thing to do here is that, if the user doesn't use any argument, we should display the Help menu. With that said, we need to add a function to perform this kind of validation for us, so let's go ahead and add a function called validate_args. You can add this function right ...

Get Python Programming Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.