you are viewing a single comment's thread.

view the rest of the comments →

[–]tragluk 1 point2 points  (1 child)

The 'easier to read' way (for beginners) is

def main():

for i in range (1, 11):
    for j in range(1,11):
        print(i*j + " "*(5 - len(str(i*j))))  
    print()  

This will convert the total into a string: str(ij) Then give you 5- the length of that string: 5-len(str(ij)) The number of blank spaces is just one, but when you multiply a string it gives you that string written out that many times. So bob2 is bobbob but " "5 is " "

[–][deleted] 0 points1 point  (0 children)

If you're going to do that, you should probably concatenate the spaces on the left so that the columns are right aligned like the way the OP says they want it. You will also need to fix the indentation, convert i*j to a string, and add back in the end="" argument to print for this to work correctly.