How to Print Variables Without Spaces Between Them in Python?

Estimated read time 1 min read

To print variables without spaces between them in Python, you can use the sep parameter of the print() function. The sep parameter specifies the separator string between the values that are passed to the print() function. By default, the separator string is a space character.

To print variables without spaces between them, you can set the sep parameter to an empty string (''). Here’s an example:

a = 10
b = 20
c = 30

print(a, b, c, sep='')

Output:

102030

In the above example, the values of a, b, and c are printed without any spaces between them. The print() function concatenates the values and uses an empty string ('') as the separator.

You May Also Like

More From Author

+ There are no comments

Add yours

Leave a Reply