the ` symbol (above the tab key) three times will show a block of code in the forum as I have done. You need to indent lines under a definition just like how you would indent lines under an "if" or an else" statement for example. I just want to run indented lines of code like I can in pycharm. tl;dr try to add 4 spaces to the start of your second line like this: def shut_down(s): if s == "yes" It is recommended to use 4 spaces for indentation in Python, tabulation or a different number of spaces may work, but it is also known to cause trouble at times. IndentationError: expected an indented block >>> Suggested alternative C-M-x does not work for me, it seems to always be sending top level function, which is not what I want most of times (or possibly a bug as it should I belive send block ?). IndentationError: expected an indented block. Take a look at the Markdown Cheatsheet to see how to format code in the forum. IndentationError: expected an indented block. Lines that are under the indent are part of the definition. Python enforces it with an iron fist. 2 Answers 2. Most programming languages permit indentation, but don't enforce it. Viewing 4 posts - 1 through 4 (of 4 total) Author Posts flag 2 answers to this question. If you're using tabs stick to tabs and if you're using space stick to space. answer comment. IndentationError: expected an indented block I wrote it like the rest of the code, i pressed tab once for it, but there are four white spaces. Another three of those will show the end of the block. × Attention, ce sujet est très ancien. Python uses indentation to determine the grouping of statements. For example, when testing functionality within a definition. File "", line 3 print 1 ^ IndentationError: expected an indented block It’s quite hard to understand what is happening here, it’s seem that there is an indent block… But as I said, I’ve used tabs and spaces, and you should never do that. We would need to figure out how to handle cases where you want to intentionally paste indented blocks of code, or how many people would be unhappy if this was the default behavior. IndentationError: expected an indented block × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié. So you need to move all those lines below def by one tab. Python requires its code to be indented and spaced properly. Is recommended to use spaces instead of tabs, but is not required. python-programming; python; Jun 17, 2019 in Python by Rhea • 4,866 views. I would really like line by line behaviour. if condition : statements //Look at the indentation here ... Out-of-block //And here Refer to this for some explanation. You get the nice syntax highlighting and everything! Never mix tabs and spaces. Home › Forums › Courses › Python for Security Professionals Course › IndentationError: expected an indented block This topic contains 3 replies, has 3 voices, and was last updated by Paul Rouk 3 years ago. @qubitron Is this possible? You can use one or more spaces or one or more tab, just that within the same statement always use one or the other. IndentationError: expected an indented block Traceback (most recent call last): File "process_simple_triggers.py", line 5, in from process_operations import * File "F:\Mount and Blade - Warband\Modules\Hispania 1200 - Copy\Hispania 1200 Enhanced source code\process_operations.py", line 14, in Indentation of program statements is critical to the readability of code. more on that can be read on PEP8.. What did i do wrong All function blocks, as well as if-else, looping blocks have to be indented by a tab or 4 spaces (depending on environment). 0 votes.