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

24th Feb 2017, 9:58 AM
Kurian John
Kurian John - avatar
4 odpowiedzi
+ 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
24th Feb 2017, 12:52 PM
visph
visph - avatar
+ 1
Python doesn't need it. Indentation is used for these purposes.
24th Feb 2017, 10:53 AM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
0
what is indentation ?
24th Feb 2017, 11:19 AM
Kurian John
Kurian John - avatar
0
indentation is starting space in every line, write and compile some code in python. .you will understand what I mean
24th Feb 2017, 11:22 AM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar