random module Built-in Dry Run in PYTHON

random module Built-in is an interactive PYTHON dry run visualizer from the Builtin programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.

This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.

random module Built-in Program Code

import random

# Use a seed so this teaching example gives the same results
random.seed(7)

# Random number between 0 and 1
print("Random float:", random.random())

# Random integer between 1 and 10 (inclusive)
print("Random dice roll:", random.randint(1, 10))

# Random choice from a list
colors = ["Red", "Blue", "Green", "Yellow"]
print("Random color:", random.choice(colors))

# Shuffle a list
cards = ["Ace", "King", "Queen", "Jack"]
random.shuffle(cards)
print("Shuffled cards:", cards)

# Random float in a range
print("Random between 5 and 10:", random.uniform(5, 10))

View the complete Builtin programs page.

Program Console random module Built-in Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.