I am working on a project called "Print Table" from 'Automate The Boring Stuff with Python' book. And I struggled to print every sublist side by side. Here is the list of items after I equalized characther numbers:
newtable = [[' apples', ' oranges', 'cherries', ' banana'], ['Alice', ' Bob', 'Carol', 'David'], [' dogs', ' cats', 'moose', 'goose']]
Here is how it should look in the end:
apples Alice dogs
oranges Bob cats
cherries Carol moose
banana David goose
And here is how I handled it in dumbest way possible:
for x in newtable:
xi = newtable.index(x)
for y in x:
yi = newtable[xi].index(y)
for z in newtable:
zi = newtable.index(z)
print(newtable[zi][yi],end=" ")
print("\n")
break
It works but i want to find out how can i make it with less headaches. How could i make it with .join() or sth. else?