New coding words
randomimportrandintelifchance
Aim: Make Python choose numbers by chance.
randomimportrandintelifchanceRoll a six-sided die and choose a message based on its value.
Tab indents. Esc then Tab leaves the editor. Ctrl/⌘ + Enter runs your code.
Select Run my code to try this program.
Roll for a player and computer, then use conditions to choose the winner.
Tab indents. Esc then Tab leaves the editor. Ctrl/⌘ + Enter runs your code.
Select Run my code to try this program.
Complete these activities in the mini-project editor above. After each change, select Run my code to check your program’s output or drawing.
Select Download my work and save the file as week_9_dice_battle.py. The .py ending tells us that the file contains Python code. Keep this file as a copy of your finished program.

random.randint(1, 6)Your answers are checked in this browser and are not submitted.
Finished Week 9?
This progress is saved only in this browser.