Skip to main content
Roll a die with random.choice(), count each face in a dictionary, and draw lottery numbers with random.sample(), seeded so every run gives the same results. Open Lab 35 in the IP Lab Portal

What you will practice

  • Seed the generator
  • Pick with choice() and sample()
  • Count outcomes in a dictionary

Before you start

Time

20 minutes

Where

IP Lab Portal

Module

Module 14: Modules and imports

  • In the IP Lab Portal, open Lab 35 - Dice and lottery with random.
  • In class, this lab comes right after the Lesson 3 recap slide in Module 14 core material.