jeudi 29 avril 2021

Using Python, I am trying to print patter where each subsequent column is squared

Here is the pattern I am trying to print:

1
2 4
3 9 27
4 16 64 256
5 25 125 625 3125

Here is what I have so far, and I am stuck at this point.

for rows in range(1,5+1):
    for columns in range(rows):
        columns= (rows)**rows
        print(columns , end=' ')
    print('')

Thanks for helping a newbie!

Aucun commentaire:

Enregistrer un commentaire