PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

Python · Theory

random module

← All stacks

Theory

51/268

random module

random module is a Python idea you use in small programs. Learn it with one example, not a long speech.

For random module — import math brings tools in. A .py file can be a module. venv keeps project packages separate.

random module — output — a dice face then one name. seed(1) makes this run repeatable in class.

Exam tip

Dice: randint(1, 6).

Example

# random
import random
random.seed(1)
print(random.randint(1, 6))
print(random.choice(["Asha", "Ravi", "Neha"]))

random module — output: a dice face then one name. seed(1) makes this run repeatable in class.

Short notes

  • Defrandom module — one clear use.
  • RuleTiny script + printed result.
  • TrapName only, no example.

Questions

1

Explain random module as if you are teaching a junior — definition, then one tiny script.

2

What does the example print, and why?

3

What mistake do freshers make with random module?

Previous← os moduleNextstatistics module →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.