# Calculate the average of a list
numbers = [10, 20, 30, 40, 50]
# Sum the numbers
total = sum(numbers)
# Count the numbers
count = len(numbers)
# Compute average
average = total / count
print(f"The average is {average}")The average is 30.0
October 27, 2025
Literate programming is a prosegramming method invented by Donald Knuth, where code is written as a “human-readable narrative”.
A literate programming system typically supports two main processes that transform a single source file into two different outputs:
# Calculate the average of a list
numbers = [10, 20, 30, 40, 50]
# Sum the numbers
total = sum(numbers)
# Count the numbers
count = len(numbers)
# Compute average
average = total / count
print(f"The average is {average}")The average is 30.0
# lines act like narrative sections in a literate programProsegrammers