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