Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Creating a Python Dice Roll Application (Summary)

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 video course, 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()

Here are additional resources mentioned in the course:

Download

Course Slides (.pdf)

4.4 MB
Download

Sample Code (.zip)

6.2 KB

00:00 Congratulations on completing Creating a Python Dice Roll Application. Looks like the odds were in your favor. This TUI app you’ve built is capable of simulating rolling up to six, six-sided dice in Python.

00:12 You learned and practiced fundamental Python skills like interacting with a user, writing functions, using loops and conditionals, as well as manipulating strings to construct clean, well-formatted outputs.

00:23 Throughout this course, you’ve learned how to use random.randint() to simulate dice-rolling events, how to capture and read user inputs using the built-in input() function, how to display ASCII art representations of dice faces to the user with print(), how to manipulate Python strings using methods like .center() and .join(), and how to improve the design of a Python program using refactoring.

00:47 So where can you go from here? There are a number of ways you could build on this app. You could add support for rolling any number of dice instead of just one to six.

00:56 You could introduce dice with different numbers of faces like the ones used for another kind of roll-playing game, or you could even implement other dice games using this app as a component.

01:07 Alternatively, you could stick around and keep on learning. The command-line interface for your dice app was about as simple as it gets. If you’d like to learn to build more complex CLIs, check out Building Command Line Interfaces With argparse.

01:20 If however, you’re interested in building another TUI that you can enjoy in the terminal, Create Conway’s Game of Life with Python is a great pick. The Game of Life itself is also a fascinating piece of computer science history.

01:32 Or if you’d like to go beyond TUI and implement a graphical user interface, a good start would be Build a Tic-Tac-Toe Game with Python and tkinter.

01:43 Now I leave you with a few lines from a great poet. We go out in the world and take our chances. Fate is just the weight of circumstances. That’s the way that Lady Luck dances.

01:57 My name is Joseph. Thank you for watching.

Become a Member to join the conversation.