0

I have two list, and I want to print side by side both of them.

list1 =[(15, 'dog'), (10, 'leopard'), (5, 'bird')] 
list1 =[(20, 'table'), (23, 'PC'), (13, 'TV')] 

When a print them my output is horrible:

List1:                                    List2:
dog                 Freq --> 15           table           Freq --> 20
leopard                 Freq --> 10       PC            Freq --> 23
bird                Freq --> 5            TV            Fre1 --> 13

I what something like that:

List1:                                    List2:
dog                 Freq --> 15           table         Freq --> 20
leopard             Freq --> 10           PC            Freq --> 23
bird                Freq --> 5            TV            Fre1 --> 13

I can't use modules for make table.

Thanks in advance for the help

1 Answers1

0

Try to use the center(), ljust() and rjust() methods for strings. They work generally in this way:

`str.ljust(width[, fillchar])`

where fillchar will be the character you pick can also be a sequence of characters) and width is the total lenght of the output (content + spacing). The main difference between those three method lies in the positioning of the string you want to justify (centered, left-justified or right-justified).