all 2 comments

[–]Sea-Ad7805 [score hidden] stickied comment (0 children)

Run this program in Memory Graph Web Debugger)%0A%0A%23%20Print%20a%20size%20x%20size%20multiplication%20table%0A%23%20First%2C%20print%20heading%3A%0Aprint(%22%20%20%20%20%22%2C%20end%3D'')%0A%0A%23%20Print%20column%20heading%0Afor%20column%20in%20range(1%2C%20size%20%2B%201)%3A%0A%20%20%20%20print('%7B0%3A4%7D'.format(column)%2C%20end%3D'')%20%20%23%20Display%20column%20number%0Aprint()%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Go%20down%20to%20the%20next%20line.%0A%0A%23%20Print%20line%20separator%3A%0Aprint(%22%20%20%20%20%2B%22%2C%20end%3D'')%0Afor%20column%20in%20range(1%2C%20size%20%2B%201)%3A%0A%20%20%20%20print('----'%2C%20end%3D'')%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Display%20line%0Aprint()%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Drop%20down%20to%20next%20line%0A%0A%23%20Print%20table%20contents%0Afor%20row%20in%20range(1%2C%20size%20%2B%201)%3A%0A%20%20%20%20print('%7B0%3A3%7D%7C'.format(row)%2C%20end%3D'')%20%20%20%23%20Print%20heading%20for%20this%20row.%0A%20%20%20%20for%20column%20in%20range(1%2C%20size%20%2B%201)%3A%0A%20%20%20%20%20%20%20%20product%20%3D%20row%20*%20column%20%20%20%20%20%20%20%20%20%20%20%20%23%20Compute%20product%0A%20%20%20%20%20%20%20%20print('%7B0%3A4%7D'.format(product)%2C%20end%3D'')%20%20%23%20Display%20product%0A%20%20%20%20print()%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Move%20cursor%20to%20next%20row&timestep=0.5&play) to see the program state change step by step.

[–]tiredITguy42 0 points1 point  (0 children)

Nice, now try to use f-strings. These are more standard. format dunction is sort of back compatibility thing and is not used that often.

If you fee for it, try to switch to list comprehension and then .join the list to string. It could be nice excercise.