Print function

How do I print two integer numbers in different lines using the same one print function ?

you could use new line character? '\n'

1 Like

yes but the numbers are printed like this
1
2
i was wondering if there is another way

But that is what you wanted, no?

Difficult to say without seeing any code at all, or an idea of what you want

yes, sorry

>>> print(1, '\n', 2)
1
 2

it doesnt printing the second number exactly under the first one

using , to print multiple arguments will introduce spaces. You could use .format():

https://pyformat.info/

or f-string if you have at least python 3.6

1 Like

The print function has a keyword argument “sep”. This is what will be put between the values passed into the print function.
So:

print(1,2, sep="\n")
2 Likes