Building small projects, like a text-based user interface (TUI) dice-rolling application, will help you level up your Python programming skills. Youβll learn how to gather and validate the userβs input, import code from modules and packages, write functions, use for loops and conditionals, and neatly display output by using strings and the print() function.
In this project, youβll code an application that simulates dice-rolling events. To do so, youβll use Pythonβs random module.
In this tutorial, youβll learn how to:
- Use
random.randint()to simulate dice-rolling events - Ask for the userβs input using the built-in
input()function - Parse and validate the userβs input
- Manipulate strings using methods, such as
.center()and.join()
Youβll also learn the basics of how to structure, organize, document, and run your Python programs and scripts.
Click the link below to download the entire code for this dice-rolling application and follow along while you build the project yourself:
Get Source Code: Click here to get the source code youβll use to build your Python dice-rolling app.
Demo
In this step-by-step project, youβll build an application that runs dice-rolling simulations. The app will be able to roll up to six dice, with each die having six faces. After every roll, the application will generate an ASCII diagram of dice faces and display it on the screen. The following video demonstrates how the app works:

When you run your dice-rolling simulator app, you get a prompt asking for the number of dice you want to roll. Once you provide a valid integer from 1 to 6, inclusive, then the application simulates the rolling event and displays a diagram of dice faces on the screen.
Project Overview
Your dice-rolling simulator app will have a minimal yet user-friendly text-based user interface (TUI), which will allow you to specify the number of six-sided dice that youβd like to roll. Youβll use this TUI to roll the dice at home without having to fly to Las Vegas.
Hereβs a description of how the app will work internally:
| Tasks to Run | Tools to Use | Code to Write |
|---|---|---|
| Prompt the user to choose how many six-sided dice to roll, then read the userβs input | Pythonβs built-in input() function |
A call to input() with appropriate arguments |
| Parse and validate the userβs input | String methods, comparison operators, and conditional statements | A user-defined function called parse_input() |
| Run the dice-rolling simulation | Pythonβs random module, specifically the randint() function |
A user-defined function called roll_dice() |
| Generate an ASCII diagram with the resulting dice faces | Loops, list.append(), and str.join() |
A user-defined function called generate_dice_faces_diagram() |
| Display the diagram of dice faces on the screen | Pythonβs built-in print() function |
A call to print() with appropriate arguments |
Keeping these internal workings in mind, youβll code three custom functions to provide the appβs main features and functionalities. These functions will define your codeβs public API, which youβll call to bring the app to life.
To organize the code of your dice-rolling simulator project, youβll create a single file called dice.py in a directory of your choice in your file system. Go ahead and create the file to get started!
Prerequisites
You should be comfortable with the following concepts and skills before you start building this dice-rolling simulation project:
- Ways to run scripts in Python
- Pythonβs
importmechanism - The basics of Python data types, mainly strings and integer numbers
- Basic data structures, especially lists
- Python variables and constants
- Python comparison operators
- Boolean values and logical expressions
- Conditional statements
- Python
forloops - The basics of input, output, and string formatting in Python
If you donβt have all of the prerequisite knowledge before starting this coding adventure, then thatβs okay! You might learn more by going ahead and getting started! You can always stop and review the resources linked here if you get stuck.
Step 1: Code the TUI of Your Python Dice-Rolling App
In this step, youβll write the required code to ask for the userβs input of how many dice they want to roll in the simulation. Youβll also code a Python function that takes the userβs input, validates it, and returns it as an integer number if the validation was successful. Otherwise, the function will ask for the userβs input again.
To download the code for this step, click the following link and navigate to the source_code_step_1/ folder:
Get Source Code: Click here to get the source code youβll use to build your Python dice-rolling app.
Take the Userβs Input at the Command Line
To get your hands dirty, you can start writing the code that interacts with the user. This code will provide the appβs text-based interface and will rely on input(). This built-in function reads the user input from the command line. Its prompt argument allows you to pass a description of what type of input you need.
Fire up your favorite editor or IDE and type the following code into your dice.py file:
1# dice.py
2
3# ~~~ App's main code block ~~~
4# 1. Get and validate user's input
5num_dice_input = input("How many dice do you want to roll? [1-6] ")
6num_dice = parse_input(num_dice_input)
Your call to input() on line 5 displays a prompt asking how many dice the user wants to roll. The number must fall in the interval from 1 to 6, inclusive, as the prompt suggests.
Note: By adding the comment on line 3, youβre separating the applicationβs main code from the rest of the code that youβll be adding in upcoming sections.
Likewise, the comment on line 4 reflects the specific task youβre performing at that moment. Youβll find more comments like these in other sections of this tutorial. These comments are optional, so feel free to get rid of them if youβd like.
Line 6 calls parse_input() and stores the return value in num_dice. In the following section, youβll implement this function.
Parse and Validate the Userβs Input
The job of parse_input() is to take the userβs input as a string, check if itβs a valid integer number, and return it as a Python int object. Go ahead and add the following to your dice.py file, right before the appβs main code:
1# dice.py
2
3def parse_input(input_string):
4 """Return `input_string` as an integer between 1 and 6.
5
6 Check if `input_string` is an integer number between 1 and 6.
7 If so, return an integer with the same value. Otherwise, tell
8 the user to enter a valid number and quit the program.
9 """
10 if input_string.strip() in {"1", "2", "3", "4", "5", "6"}:
11 return int(input_string)
12 else:
13 print("Please enter a number from 1 to 6.")
14 raise SystemExit(1)
15
16# ~~~ App's main code block ~~~
17# ...
Hereβs how this code works line by line:
-
Line 3 defines
parse_input(), which takes the input string as an argument. -
Lines 4 to 9 provide the functionβs docstring. Including an informative and well-formatted docstring in your functions is a best practice in Python programming because docstrings allow you to document your code.
-
Line 10 checks if the user input is a valid value for the number of dice to roll. The call to
.strip()removes any unwanted spaces around the input string. Theinoperator checks if the input falls within the set of allowed numbers of dice to roll. In this case, you use a set because membership tests in this Python data structure are quite efficient. -
Line 11 converts the input into an integer number and returns it to the caller.
-
Line 13 prints a message to the screen to alert the user of invalid input, if applicable.
-
Line 14 exits the app with a
SystemExitexception and a status code of1to signal that something went wrong.
With parse_input(), you process and validate the userβs input at the command line. Validating any input that comes directly from the user or any untrusted sources is key for your application to work reliably and securely.
Note: The line numbers in the code samples in this tutorial are intended to facilitate the explanation. Most of the time, they wonβt match the line numbers in your final script.
Now that you have a user-friendly TUI and a proper input validation mechanism, you need to make sure that these functionalities work correctly. Thatβs what youβll do in the following section.
Try Out the Dice-Rolling Appβs TUI
To try out the code that youβve written so far, open a command-line window and run your dice.py script:
$ python dice.py
How many dice do you want to roll? [1-6] 3
$ python dice.py
How many dice do you want to roll? [1-6] 7
Please enter a number from 1 to 6.
If you enter an integer number from 1 to 6, then the code doesnβt display a message. On the other hand, if the input isnβt a valid integer number or falls outside the target interval, then you get a message telling you that an integer number from 1 to 6 is required.
Up to this point, youβve successfully written code to request and parse the userβs input at the command line. This code provides the applicationβs TUI, which is based on the built-in input() function. Youβve also coded a function to validate the userβs input and return it as an integer number. Now, itβs time to roll the dice!
Step 2: Simulate the Rolling of Six-Sided Dice in Python
Your dice-rolling app now provides a TUI to take the userβs input and process it. Great! To continue building the applicationβs main functionality, youβll write the roll_dice() function, which will allow you to simulate a dice-rolling event. This function will take the number of dice that the user wants to roll.
Pythonβs random module from the standard library provides the randint() function, which generates pseudo-random integer numbers in a given interval. Youβll take advantage of this function to simulate rolling dice.
To download the code for this step, click the following link and look inside the source_code_step_2/ folder:
Get Source Code: Click here to get the source code youβll use to build your Python dice-rolling app.
Hereβs the code that implements roll_dice():
1# dice.py
2import random
3
4# ...
5
6def roll_dice(num_dice):
7 """Return a list of integers with length `num_dice`.
8
9 Each integer in the returned list is a random number between
10 1 and 6, inclusive.
11 """
12 roll_results = []
13 for _ in range(num_dice):
14 roll = random.randint(1, 6)
15 roll_results.append(roll)
16 return roll_results
17
18# ~~~ App's main code block ~~~
19# ...
In this code snippet, line 2 imports random into your current namespace. This import allows you to access the randint() function later. Hereβs a breakdown of the rest of the code:
-
Line 6 defines
roll_dice(), which takes an argument representing the number of dice to roll in a given call. -
Lines 7 to 11 provide the functionβs docstring.
-
Line 12 creates an empty list,
roll_results, to store the results of the dice-rolling simulation. -
Line 13 defines a
forloop that iterates once for each die that the user wants to roll. -
Line 14 calls
randint()to generate a pseudo-random integer number from 1 to 6, inclusive. This call generates a single number on each iteration. This number represents the result of rolling a six-sided die. -
Line 15 appends the current die-rolling result in
roll_results. -
Line 16 returns the list of dice-rolling simulation results.
To try out your newly created function, add the following lines of code to the end of your dice.py file:
1# dice.py
2# ...
3
4# ~~~ App's main code block ~~~
5# 1. Get and validate user's input
6num_dice_input = input("How many dice do you want to roll? [1-6] ")
7num_dice = parse_input(num_dice_input)
8# 2. Roll the dice
9roll_results = roll_dice(num_dice)
10
11print(roll_results) # Remove this line after testing the app
In this code, line 9 calls roll_dice() with num_dice as an argument. Line 11 calls print() to show the result as a list of numbers on your screen. Each number in the list represents the result for a single die. You can remove line 11 after testing your code.
Go ahead and run your app from the command line:
$ python dice.py
How many dice do you want to roll? [1-6] 5
[6, 1, 3, 6, 6]
$ python dice.py
How many dice do you want to roll? [1-6] 2
[2, 6]
The lists of results on your screen will be different because youβre generating your own pseudo-random numbers. In this example, you simulate the rolling of five and two dice, respectively. The value of each die is between 1 and 6 because youβre working with six-sided dice.
Now that youβve written and tried out the code that simulates a dice-rolling event, itβs time to move on and provide your application with a flashy way to display these results. Thatβs what youβll do in the next section.
Step 3: Generate and Display the ASCII Diagram of Dice Faces
At this point, your app already simulates the rolling of several dice and stores the results as a list of numbers. A list of numbers doesnβt look attractive from the userβs perspective, though. You need a fancier output so that your app looks professional.
In this section, youβll write code to generate a diagram showing the faces of up to six dice. To do this, youβll create a bit of ASCII art.
Click the link below to download the code for this step so that you can follow along with the project. Youβll find what you need in the source_code_step_3/ folder:
Get Source Code: Click here to get the source code youβll use to build your Python dice-rolling app.
Set Up the Diagram of Dice Faces
Your dice-rolling simulator app needs a way to show the result of rolling the dice. To this end, youβll use an ASCII diagram of dice faces thatβll show the result of rolling the desired number of six-sided dice. For example, after rolling four dice, the diagram will look something like this:
~~~~~~~~~~~~~~~~~~~ RESULTS ~~~~~~~~~~~~~~~~~~~
βββββββββββ βββββββββββ βββββββββββ βββββββββββ
β β β β β β β β β β β β
β β β β β β β β β β
β β β β β β β β β β β β
βββββββββββ βββββββββββ βββββββββββ βββββββββββ
Each die face in this diagram reflects the value that results from one iteration of the simulation. To start coding the functionality to build this diagram, you need to put together some ASCII art. Get back to your code editor and add the following:
1# dice.py
2import random
3
4DICE_ART = {
5 1: (
6 "βββββββββββ",
7 "β β",
8 "β β β",
9 "β β",
10 "βββββββββββ",
11 ),
12 2: (
13 "βββββββββββ",
14 "β β β",
15 "β β",
16 "β β β",
17 "βββββββββββ",
18 ),
19 3: (
20 "βββββββββββ",
21 "β β β",
22 "β β β",
23 "β β β",
24 "βββββββββββ",
25 ),
26 4: (
27 "βββββββββββ",
28 "β β β β",
29 "β β",
30 "β β β β",
31 "βββββββββββ",
32 ),
33 5: (
34 "βββββββββββ",
35 "β β β β",
36 "β β β",
37 "β β β β",
38 "βββββββββββ",
39 ),
40 6: (
41 "βββββββββββ",
42 "β β β β",
43 "β β β β",
44 "β β β β",
45 "βββββββββββ",
46 ),
47}
48DIE_HEIGHT = len(DICE_ART[1])
49DIE_WIDTH = len(DICE_ART[1][0])
50DIE_FACE_SEPARATOR = " "
51
52# ...
In lines 4 to 47, you draw six dice faces using ASCII characters. You store the faces in DICE_ART, a dictionary that maps each face to its corresponding integer value.
Line 48 defines DIE_HEIGHT, which holds the number of rows a given face will occupy. In this example, each face takes up five rows. Similarly, line 49 defines DIE_WIDTH to hold the number of columns required to draw a die face. In this example, the width is 11 characters.
Finally, line 50 defines DIE_FACE_SEPARATOR, which holds a whitespace character. Youβll use all these constants to generate and display the ASCII diagram of dice faces for your application.
Generate the Diagram of Dice Faces
At this point, youβve built the ASCII art for each die face. To put these pieces together into a final diagram representing the complete results of the dice-rolling simulation, youβll write another custom function:
1# dice.py
2
3# ...
4
5def generate_dice_faces_diagram(dice_values):
6 """Return an ASCII diagram of dice faces from `dice_values`.
7
8 The string returned contains an ASCII representation of each die.
9 For example, if `dice_values = [4, 1, 3, 2]` then the string
10 returned looks like this:
11
12 ~~~~~~~~~~~~~~~~~~~ RESULTS ~~~~~~~~~~~~~~~~~~~
13 βββββββββββ βββββββββββ βββββββββββ βββββββββββ
14 β β β β β β β β β β β β
15 β β β β β β β β β β
16 β β β β β β β β β β β β
17 βββββββββββ βββββββββββ βββββββββββ βββββββββββ
18 """
19 # Generate a list of dice faces from DICE_ART
20 dice_faces = []
21 for value in dice_values:
22 dice_faces.append(DICE_ART[value])
23
24 # Generate a list containing the dice faces rows
25 dice_faces_rows = []
26 for row_idx in range(DIE_HEIGHT):
27 row_components = []
28 for die in dice_faces:
29 row_components.append(die[row_idx])
30 row_string = DIE_FACE_SEPARATOR.join(row_components)
31 dice_faces_rows.append(row_string)
32
33 # Generate header with the word "RESULTS" centered
34 width = len(dice_faces_rows[0])
35 diagram_header = " RESULTS ".center(width, "~")
36
37 dice_faces_diagram = "\n".join([diagram_header] + dice_faces_rows)
38 return dice_faces_diagram
39
40# ~~~ App's main code block ~~~
41# ...
This function does the following:
-
Line 5 defines
generate_dice_faces_diagram()with a single argument calleddice_values. This argument will hold the list of dice-rolling integer values that results from callingroll_dice(). -
Lines 6 to 18 provide the functionβs docstring.
-
Line 20 creates an empty list called
dice_facesto store the dice faces corresponding to the input list of dice values. These dice faces will display in the final ASCII diagram. -
Line 21 defines a
forloop to iterate over the dice values. -
Line 22 retrieves the die face corresponding to the current die value from
DICE_ARTand appends it todice_faces. -
Line 25 creates an empty list to hold the rows in the final dice faces diagram.
-
Line 26 defines a loop that iterates over indices from
0toDIE_HEIGHT - 1. Each index represents the index of a given row in the dice faces diagram. -
Line 27 defines
row_componentsas an empty list to hold portions of the dice faces that will fill a given row. -
Line 28 starts a nested
forloop to iterate over the dice faces. -
Line 29 stores each row component.
-
Line 30 joins the row components into a final row string, separating individual components with spaces.
-
Line 31 appends each row string to the list holding the rows thatβll shape the final diagram.
-
Line 34 creates a temporary variable to hold the
widthof the current dice faces diagram. -
Line 35 creates a header showing the word RESULTS. To do so, it uses
str.center()with the diagramβswidthand the tilde symbol (~) as arguments. -
Line 37 generates a string that holds the final dice faces diagram. The line feed character (
\n) works as a row separator. The argument to.join()is a list of strings concatenating the diagram header and the strings (rows) that shape the dice faces. -
Line 38 returns a ready-to-print dice faces diagram to the caller.
Wow! That was a lot! Youβll go back to this code and improve it to make it more manageable in just a bit. Before doing that, though, youβll want to try out your application, so you need to finish writing its main code block.
Finish Up the Appβs Main Code and Roll the Dice
With generate_dice_faces_diagram() in place, you can now finish writing the applicationβs main code, which will allow you to actually generate and display the diagram of dice faces on your screen. Go ahead and add the following lines of code to the end of dice.py:
1# dice.py
2
3# ...
4
5# ~~~ App's main code block ~~~
6# 1. Get and validate user's input
7num_dice_input = input("How many dice do you want to roll? [1-6] ")
8num_dice = parse_input(num_dice_input)
9# 2. Roll the dice
10roll_results = roll_dice(num_dice)
11# 3. Generate the ASCII diagram of dice faces
12dice_face_diagram = generate_dice_faces_diagram(roll_results)
13# 4. Display the diagram
14print(f"\n{dice_face_diagram}")
Line 12 calls generate_dice_faces_diagram() with roll_results as an argument. This call builds and returns a diagram of dice faces that corresponds to the current dice-rolling results. Line 14 calls print() to display the diagram on the screen.
With this update, you can run the application again. Get back to your command line and execute the following command:
$ python dice.py
How many dice do you want to roll? [1-6] 5
~~~~~~~~~~~~~~~~~~~~~~~~~ RESULTS ~~~~~~~~~~~~~~~~~~~~~~~~~
βββββββββββ βββββββββββ βββββββββββ βββββββββββ βββββββββββ
β β β β β β β β β β β β β β β β β β β
β β β β β β β β β β β β β β β β
β β β β β β β β β β β β β β β β β β β
βββββββββββ βββββββββββ βββββββββββ βββββββββββ βββββββββββ
Cool! Now your dice-rolling simulator app displays a nicely formatted ASCII diagram showing the result of the simulation event. Thatβs neat, isnβt it?
If you go back to the implementation of generate_dice_faces_diagram(), then youβll note that it includes a few comments that point out what the corresponding portion of code is doing:
def generate_dice_faces_diagram(dice_values):
# ...
# Generate a list of dice faces from DICE_ART
dice_faces = []
for value in dice_values:
dice_faces.append(DICE_ART[value])
# Generate a list containing the dice faces rows
dice_faces_rows = []
for row_idx in range(DIE_HEIGHT):
row_components = []
for die in dice_faces:
row_components.append(die[row_idx])
row_string = DIE_FACE_SEPARATOR.join(row_components)
dice_faces_rows.append(row_string)
# Generate header with the word "RESULTS" centered
width = len(dice_faces_rows[0])
diagram_header = " RESULTS ".center(width, "~")
dice_faces_diagram = "\n".join([diagram_header] + dice_faces_rows)
return dice_faces_diagram
This kind of comment often signals that your code would benefit from some refactoring. In the following section, youβll use a popular refactoring technique that will help you clean up the code and make it more maintainable.
Step 4: Refactor the Code That Generates the Diagram of Dice Faces
Your generate_dice_faces_diagram() function requires explanatory comments because it performs several operations at a time, which violates the single-responsibility principle.
Roughly stated, this principle says that every function, class, or module should do only one thing. That way, changes in a given functionality wonβt break the rest of the code. As a result, youβll end up with a more robust and maintainable code.
To download the code for this step, click the link below, then check out the source_code_step_4/ folder:
Get Source Code: Click here to get the source code youβll use to build your Python dice-rolling app.
Thereβs a refactoring technique called extract method that can help you improve your code by extracting functionality that can work independently. For example, you can extract the code from line 20 to 22 in the previous implementation of generate_dice_faces_diagram() and place it in a non-public helper function called _get_dice_faces():
def _get_dice_faces(dice_values):
dice_faces = []
for value in dice_values:
dice_faces.append(DICE_ART[value])
return dice_faces
You can call _get_dice_faces() from generate_dice_faces_diagram() to get the implied functionality. By using this technique, you can fully refactor generate_dice_faces_diagram() to satisfy the single-responsibility principle.
Note: To learn more about naming non-public functions with a leading underscore (_), check out The Meaning of Underscores in Python.
Hereβs a refactored version of generate_dice_faces_diagram() that takes advantage of _get_dice_faces() and implements another helper function called _generate_dice_faces_rows() to extract the functionality from line 25 to 31:
# dice.py
# ...
def generate_dice_faces_diagram(dice_values):
"""Return an ASCII diagram of dice faces from `dice_values`.
The string returned contains an ASCII representation of each die.
For example, if `dice_values = [4, 1, 3, 2]` then the string
returned looks like this:
~~~~~~~~~~~~~~~~~~~ RESULTS ~~~~~~~~~~~~~~~~~~~
βββββββββββ βββββββββββ βββββββββββ βββββββββββ
β β β β β β β β β β β β
β β β β β β β β β β
β β β β β β β β β β β β
βββββββββββ βββββββββββ βββββββββββ βββββββββββ
"""
dice_faces = _get_dice_faces(dice_values)
dice_faces_rows = _generate_dice_faces_rows(dice_faces)
# Generate header with the word "RESULTS" centered
width = len(dice_faces_rows[0])
diagram_header = " RESULTS ".center(width, "~")
dice_faces_diagram = "\n".join([diagram_header] + dice_faces_rows)
return dice_faces_diagram
def _get_dice_faces(dice_values):
dice_faces = []
for value in dice_values:
dice_faces.append(DICE_ART[value])
return dice_faces
def _generate_dice_faces_rows(dice_faces):
dice_faces_rows = []
for row_idx in range(DIE_HEIGHT):
row_components = []
for die in dice_faces:
row_components.append(die[row_idx])
row_string = DIE_FACE_SEPARATOR.join(row_components)
dice_faces_rows.append(row_string)
return dice_faces_rows
# ~~~ App's main code block ~~~
# ...
The newly added helper functions extract functionality from the original function. Now each helper function has its own single responsibility. Helper functions also allow you to use readable and descriptive names, removing the need for explanatory comments.
Refactoring your code to get it into better shape is a great skill to have as a Python developer. To dig deeper into code refactoring, check out Refactoring Python Applications for Simplicity.
A fundamental idea behind code refactoring is that the modified code should work the same as the original code. To check this principle, go ahead and run your application again!
With that, youβve completed your project! Youβve built a fully functional TUI application that allows you to simulate a dice-rolling event. Every time you run the application, you can simulate the rolling of up to six dice with six faces each. Youβll even get to see the resulting dice faces in a nice-looking ASCII diagram. Great job!
Conclusion
Youβve coded a fully functional project consisting of a text-based user interface application that simulates the rolling of six-sided dice in Python. With this project, you learned and practiced fundamental skills, such as gathering and validating the userβs input, importing code, writing functions, using loops and conditionals, and displaying nicely formatted output on-screen.
In this tutorial, you learned how to:
- Use
random.randint()to simulate the rolling of dice - Take the userβs input at the command line using the built-in
input()function - Parse and validate the userβs input using several tools and techniques
- Manipulate strings using methods, such as
.center()and.join()
Additionally, you learned how to structure, organize, document, and run Python programs and scripts. With this knowledge, youβre better prepared to continue your coding journey with Python.
You can download the full code for this dice-rolling application by clicking the link below:
Get Source Code: Click here to get the source code youβll use to build your Python dice-rolling app.
Next Steps
Now that youβve finished building your dice-rolling application, you can take the project a step further by adding new functionality. Adding new features by yourself will help you continue to learn exciting new coding concepts and techniques.
Here are some ideas to take your project to the next level:
- Support for any number of dice: Modify the code so that you can roll any number of dice.
- Support for dice with different numbers of faces: Add code to support not only six-sided dice but dice with any number of sides.
The first feature will require you to modify the code that processes the userβs input for the number of dice to roll. Youβll also need to modify the code that generates and displays the diagram of dice faces. For example, you can generate a diagram that displays the dice faces in several rows to avoid cluttering your screen with cramped output.
On the other hand, supporting dice with a different number of faces will demand that you tweak the code that simulates a dice-rolling event. Youβll also need to create new ASCII art for any dice with more than six faces.
Once youβre done with these new features, you can change gears and jump into other cool projects. Here are some great next steps for you to continue learning Python and building more complex projects:
-
How to Build Command Line Interfaces in Python With argparse: In this step-by-step Python tutorial, youβll learn how to take your command-line Python scripts to the next level by adding a convenient command-line interface that you can write with
argparse. -
Build a Python Directory Tree Generator for the Command Line: In this step-by-step project, youβll create a Python directory tree generator application for your command line. Youβll code the command-line interface with
argparseand traverse the file system usingpathlib. -
Build a Command-Line To-Do App With Python and Typer: In this step-by-step project, youβll create a to-do application for your command line using Python and Typer. While you build this app, youβll learn the basics of Typer, a modern and versatile library for building command-line interfaces.






