+ 5
How to do a indentation in python?
15 Answers
+ 7
if you wanna add an indentation to say a file or print it, just in your print statement put print(" "). Btw theres 4 spaces in there.
If you just mean when your writing code then:
on pc press tab (near top left of your keyboard)
on mobile on sololearn press tab (top left of your keyboard)
any other time where tab isn't available just hit space 4 times
also \t
+ 6
Yea, You can use 4 space or 2 space for tab to indentation in Python
If (a>b):
print (a) //4 space or 2 space
Something like that...
+ 4
no Sâñtôsh
+ 4
You can use space as your indentation by clicking the space bar four times
+ 3
lol thx Sâñtôsh
+ 2
Nice advice TriFoxi
+ 2
Ur welcome TriFoxi
Are you beginner ??
+ 1
Indentation works in some expressions such as conditional expression.
Indentation refers to the spaces at a beginning of a code line.
I would like to mention one example of conditional expression where indentation is used:-
If (5>2) :
print("five is greater than two. ")
+ 1
Soo you have to chose wich form of indentation you use if you use 4 spaces than you have to use the 4 spaces in your whole code if you mixed it with tabs than you get an error. Maybe you align all the code to the left side and indent it again and dont forget use 4 Spaces OR tab NOT both
That should fix your error
+ 1
Indentation is very important in python and use of indentation in python is given below:-
if 5>3:
print("Five is greater than three. ")
+ 1
S3R43o3 Each block must have the same indentation, but different blocks in your code can have different levels of indentation.
+ 1
Anonymous ofc on block 4 spaces or 1 tab … if you need more cause if statements or so on you have to do 8 spaces or 2 tabs and so on …