avatar Bite 355. Create Your First Typer Command Line Interface (CLI) Application

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.

Login and get coding
go back Beginner level
Bitecoin 2X

30 out of 31 users completed this Bite.
Will you be the 31st person to crack this Bite?
Resolution time: ~42 min. (avg. submissions of 5-240 min.)

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help