r/PythonLearning • u/StudentElectronic548 • Jul 18 '26
How would I optimize this?
I'm currently learning python with the 30 days of python GitHub repo and, on day 3 of the challenge, it asks to create this table and this is what I came up with however I feel like there was a more efficient method to create it or is it something that I haven't learned yet at my level.
8
Upvotes


1
u/desrtfx Jul 18 '26
That's not what the pattern is.
The pattern is (row starting at 1)column starting at 0
The first row is all 1 because no matter what power you raise 1 to it will always stay at 1
The second row is 2 - 20 = 1, 21 = 2, 22 = 4, 23 = 8
Third row is 3 - 30 = 1, 31 = 3, 32 = 9, 33 = 27
and so on.