How to give space in Python
In this article, we will learn how to give space in Python.
Printing spaces results in empty spaces being displayed. Sometimes we may need to give space between our outputs. This article will give a clear idea how to do this.
Print a Single Whitespace
We can use print(value)
with value as " "
to print a space on a single line.
>>> print("ab") ab >>> print(" ") >>> print("a") a
Print a multiple whitespaces
We can use print(value)
with value as " "*n
to print n
-many spaces on a single line.
>>> print(" "*5) >>> print(" "*5 + "abc") abc
Subscribe
Login
Please login to comment
0 Discussion