avatar Bite 354. When to Use Command Line Option (CLI) Options and When CLI Arguments?

In Typer, you can use either typer.Option or typer.Argument.

Well, you might have guessed it:

CLI options are similar to CLI arguments - but options are optional by default (while arguments are required by default).

Furthermore, CLI options have some additional functionality compared to arguments.

In this Bite, you will extend the previous CLI script and implement a simple CLI option.

For documentation, see the CLI Options Intro.

Extend the code such that it also receives an optional number c and then compare whether the sum of a and b is greater than c.

Hence, when one runs python script.py 2 3 --c 1, we expect the following response:

The sum is 5 and c is smaller
Login and get coding
go back Intermediate level
Bitecoin 3X

7 out of 7 users completed this Bite.
Will you be Pythonista #8 to crack this Bite?
Resolution time: ~20 min. (avg. submissions of 5-240 min.)

Focus on this Bite hiding sidebars, turn on Focus Mode.
We use Python 3.8