'defining the last column to be printed in python

I have a table with some data and I want to able to print just the first 4 columns to put a ratio columns just after.

for pref in range(1, len(table)) :
    print(table[pref][0].rjust(10), end=" ") 
    for age in range(1, len(table[0])):
        print(table[pref][age].rjust(5), end=" ")
    print()

I was able to do it just changing the len(table[0]) for the columns number, but I want to leave the range like that and just change the print.

Is it possible?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source