06.0 Python‎ > ‎Python Projects‎ > ‎

Dice Project


Overall Project Objectives

The student will learn and practice the following concepts:
  • various new python language constructs
  • a Python IDE (pyscript)
  • writing a well structured program using functions
  • use the built in IDE help and other Internet resources to increase their understanding
  • build basic error checking in to a program

Project Description

The student will first create a simple structured program that will simulate rolling a 6-sided die multiple times. The student will then slowly turn this into a complex well structured documented program that will simulate rolling a well behaved n-sided die multiple times.

Project Road Map

Complete this project in small steps as outlined below. Make sure you do not destroy a version of your program that is working, save a copy of it. For each phase of the project you may choose to save your files with different names. Example:  DiceVer1.0, DiceVer1.1, DiceVer 1.3 ... , DiceVer2.0, DiceVer2.1 ... This way you can go back to a previous version of your program if the current program becomes non-functional.
  1. Dice : get the dice to roll correctly
  2. Dice-rollDice(): move the code to roll into a function
  3. Dice-rollDice(x): make the number of sides on the dice flexible
  4. Dice-rollDice(?): set the default number of sides on the dice to 6
  5. Dice v4-input: ask the user to input the number of sides and number of rolls
  6. Dice v5-Errors: check to ensure the user input is valid: if the user data is incorrect, continue to ask the user for input until valid input is entered