Python Forum
putting 2 lists items side by side - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: putting 2 lists items side by side (/thread-26386.html)



putting 2 lists items side by side - Jiwan - Apr-30-2020

hi guys,

can someone advise a syntax for writing items from the list side by side in the output.
For example: Name of groceries and their price and total of the price in the end.

Regards.


RE: putting 2 lists items side by side - Larz60+ - Apr-30-2020

you can do this with f-string, using padding
x = 1234
y = 785
print(f"Header1        Header2")
print(f"{x:<15}{y:<15}")
results:
Output:
Header1 Header2 1234 785