Search⌘ K
AI Features

Quiz: Introduction to Modules and Libraries

Assess your understanding of importing and using Python modules to enhance code functionality. Practice using the random module to simulate dice rolls, reinforcing how modules and functions combine in real projects.

We'll cover the following...

In the last lesson, you discovered how to extend Python’s power by importing modules—toolboxes full of pre-written code. You explored built-in modules like random, math, and datetime, learning how to add randomness, do complex math, and work with time, all with just a single import.

Let’s test your understanding before jumping into the next challenge!

Technical Quiz
1.

What is a Python module?

A.

A file that stores variables only

B.

A toolbox of prewritten code (functions, constants, etc.)

C.

A type of loop in Python


1 / 3

Well done! You’ve learned how to import and use Python modules to bring new features into your code, without writing them from scratch.

What’s next?

Time to roll the dice—literally! In this hands-on project, you’ll:

  • Use the random module.

  • Create a function that simulates rolling two six-sided dice.

  • Print the results of each roll, just like in a real game.

This is a fun way to reinforce how modules and functions can work together in practical code.
Let’s bring chance and code together with Python!