Python Forum

Full Version: print 3 table in a 3*3 matrix format
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello guys,

Here i have to print 3 table in 3*3 matrix format
x=3
for i in range(1,10):
    print(x*i)
it gives me the output of 3 table upto 9.
But how to print these values in a 3*3 matrix format?
you can use mod operator and 3 '% 3'
when result is 0, you want a line feed
add ', end='' where you don't want a line feed
You might also want to check out this tutorial:

https://docs.python.org/3/tutorial/input...formatting