Find smallest digit in a number Dry Run in PYTHON

Find smallest digit in a number is an interactive PYTHON dry run visualizer from the Recursion 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.

Find smallest digit in a number Program Code

def smallest_digit(n):
    if n < 10:
        return n
    last = n % 10
    min_in_rest = smallest_digit(n // 10)
    return last if last < min_in_rest else min_in_rest

num = 739582
print(f"Number: {num}")
print(f"Smallest digit = {smallest_digit(num)}")

View the complete Recursion programs page.

Program Console Find smallest digit in a number Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.