CPSC120B
Fundamentals of Computer Science I

Post-lab 8

Nested Loops

Nesting loops can be a tricky concept to wrap your head around. However, it is also a VERY powerful tool to have in your repertoire. In this post=lab, you will demonstrate your understanding of nested loops by writing a program to print out multiplication tables.

Times Tables

Write a Python program that prints out the multiplication tables for all Integers in the range [0, 5].

    $ python3 times.py
    0 x 0 = 0
    0 x 1 = 0
    0 x 2 = 0
    0 x 3 = 0
    0 x 4 = 0
    0 x 5 = 0
    1 x 0 = 0
    1 x 1 = 1
    ... omitted for space ...
    4 x 5 = 20
    5 x 0 = 0
    5 x 1 = 5
    5 x 2 = 10
    5 x 3 = 15
    5 x 4 = 20
    5 x 5 = 25

Submission

Submit your code on the course Inquire site.