Pybites Logo

Create your first typer command line interface (cli) application

Level: Beginner (score: 2)

In the previous Bites, you have successfully transformed an existing script into a CLI using typer.run().

In this Bite, you will create a CLI application including more than one command to run, leveraging app = typer.Typer(). See the Commands documentation for reference.

So, create a command sum that sums two numbers and a command compare that compares two numbers:

$ python script.py sum 3 5
The sum is 8

$ python script.py compare 3 5
d=5 is greater than c=3

Check out the tests for more information on how to format the output.