Loading video player…

Defining the Project

00:00 Prior to embarking on any new project, you need to define your project’s requirements. If not, you’re likely to roll snake eyes. You’ll start by identifying the key behaviors of your application.

00:11 Ask yourself, what does this application do? And then you’ll determine the implementation strategies you’ll use to achieve them. So how can you use Python to enable those behaviors?

00:23 Watch the demo again, and see if you can deduce the steps that need to occur to make everything work as seen.

00:41 So, what are the behaviors? You might have unpacked the steps a little bit differently, but here’s the way we’ve broken them down. The app first has to request the number of dice to roll.

00:50 Then, read and validate the user’s input. In the background, do something to simulate the randomness of a dice roll. Take that result and create an ASCII diagram with the resulting dice faces, and finally, display that to the user.

01:05 So how will you be implementing these behaviors? First, for the request, you’ll use the built-in input() function with the appropriate arguments.

01:13 Then for validation, you’ll define a function called parse_input() whose internal logic will include string methods, comparison operators, and conditional statements.

01:22 To simulate random rolls, you’ll define a function called roll_dice(), which is going to depend largely on Python’s built-in random module. Generating the ASCII results will be handled by one more function that you’ll write named generate_dice_faces_diagram(), where you’ll use for loops and string manipulation methods to create ASCII art.

01:41 And finally, you’ll display those results using the built-in print() function. And now with the project well defined, you’re ready to start coding.

01:49 But first, you’ve got to ask yourself one question. Do I feel lucky? Well, do you?

01:56 If the answer is yes, meet me in the next lesson.

Become a Member to join the conversation.