0
is "{}" not used in phyton to separate loops or not to get confused by the expressions or statements inside a loop
i havint seen it inside phyton programing
4 Answers
+ 5
Indentation is the shifting of lines:
A line starting from max left position.
A line starting with a shift of four spaces.
Good practice for readability in code is to format lines with indentation, like:
function do_something(arg) {
instruction;
instruction;
if (condition) {
do another instructions;
}
}
... but most of languages accept your code if you don't indent it: syntax requirement of brackets, semi-colons and so on, are enough for parser know where start and end blocks.
Python conception is different, and syntax is light, avoiding unecessary brakets and semi-colon, but require correct indentation on the other hand ( and that's a very good thing, even is confusing at first glance ^^ ), so previous example is to write:
def do_something(arg):
instruction
instruction
if consition:
do another instructions
+ 1
Python doesn't need it. Indentation is used for these purposes.
0
what is indentation ?
0
indentation is starting space in every line, write and compile some code in python. .you will understand what I mean