06.0 Python‎ > ‎Python Projects‎ > ‎Dice Project‎ > ‎

Dice v0

Objectives

The student will learn the following new concepts:
  • Pyscripter IDE vs IDLE
  • import
  • the dot . operator
  • random
    • .seed()
    • .randint(start##,stop##)
  • Using help
The student will practice the following familiar concepts:
  • print()
  • Integer

Program Description

This program will simulate rolling a six sided die multiple times.

Enter the Program

Enter a program using IDLE
  1. Start IDLE, 
  2. Watch the screen as you type.
  3. at the >>> prompt, type import random
  4. enter the rest of the code:
    random.seed()
    for i in range(6):
        print(random.randint(1,6))
  5. Press enter again after the last line
Enter a program a second time using Pyscripter
  1. Start Pyscripter 
  2. Notice that Pyscripter creates a framework a of a basic program for you to start with.
  3. Again watch the screen as you type the program.
  4. Underneath the line #---------------, enter the import statement from above
  5. replace pass with the code from step #4 above
  6. press the run button on the tool bar ( the green triangle pointing right. 
  7. Make sure you can save your work and retrieve it later
Questions:
  1. What is an IDE? Why use an IDE over IDLE?
  2. Why is import needed in this program?
  3. Which statement uses the dot operator? Are there other words that can be used instead of .randint()?
  4. Use the Python Help Manuals to find out about random
Comments