Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)

I know that in C++, this \n is used for giving any spaces but I want to know what we can use in Python?

I don't want to have to use: 

print ("   "). 

1 Answer

0 votes
by (108k points)

Instead of that, you can use the below code:

x=' ';

The above will print one space:

print(x); 

The below code will print 10 spaces:

print(10*x) 

The below code will print 10 whites spaces between Hello & World on the Python console:

print("Hello"+10*x+"world")

Related questions

0 votes
1 answer
0 votes
0 answers
0 votes
1 answer
asked Jul 16, 2019 in Python by leealex956 (7.3k points)
0 votes
1 answer

Browse Categories

...