Automatic Indentation in Python:-

The IDLE editor has features that help you to maintain consistent indentation in your Python programs. Perhaps the most helpful of these features is automatic indentation. When you type a line that ends with a colon, such as an if clause, the first line of a loop, or a function header, and then press the Enter key, the editor automatically indents the lines that are entered next. For example, suppose you are typing the code shown in the Figure (given below). After you press the Enter key at the end of the line marked, 1) the editor will automatically indent the lines that you type next. Then, after you press the Enter key at the end of the line marked, 2) the editor indents again. Pressing the Backspace key at the beginning of an indented line cancels one level of indentation.



(Lines that cause automatic indentation.)