Anonymous Anonymous - 2 months ago
133 0

No description

Python

MultiplicationTable1_9

#Written by khay
#Modified: Changed variable names for readability

multiplicationTable = [[i * j for i in range(1, 10)] for j in range(1, 10)]
print("* |   " + " ".join(str(number).ljust(4, " ") for number in multiplicationTable[0]))
print("-" * 50)
for multiplicationNumber in range(1, len(multiplicationTable) + 1):
    print("{} |   ".format(multiplicationNumber) + " ".join(str(number).ljust(4, " ") for number in multiplicationTable[multiplicationNumber-1]))