powers-list.py

A demonstration of nested for loops.

# -*- coding: utf-8 -*-
"""
Created on Wed Mar 10 11:30:52 2021

@author: rmontant
"""
limit = int( input('maximum power? ') )

bases = []
while True:
    s = input('base? ')
    if len(s) == 0:
        break
    b = int(s)
    bases.append(b)

 for power in range(limit+1):
    print('%3d' % (power), end='  ')
   for base in bases:
        print('%6d' % (base**power), end='  ')
    print()