WebDec 20, 2024 · As long as we indent the code correctly as seen in the image below, we can avoid the error: site if site == 'edu': print ('Logging in to Springfield School!') else: print …
How to Fix IndentationError: expected an indented block
WebJan 12, 2024 · expected an indented block翻译为:应为缩进块。. python中没有像C语言使用 {}来表示从属关系,而是使用缩进表示上下级关系。. 导致excepted an indented block这个错误的原因一般有两个:. 1, 冒号后面是要写上一定的内容的。. 例如:for循环后面不写任何代码,会出现 ... WebSep 3, 2024 · File "", line 11 else: ^ IndentationError: expected an indented block I dont understand why is the notebook still asking for indentation when I already have the "else" statement indented subway j train
How to fix IndentationError: "expected an indented block"?
WebFeb 13, 2010 · Then indent all your blocks, and finally align all the instructions in the same block. Funny that didn't appear before on SO. After all, it's true it's not that obvious. In Python, you separate blocks using spaces or tabs, not "{". So any time you go down a block (a function, a loop, a class, etc), you have to indent your code. Web1. Your last for statement is missing a body. Python expects an indented block to follow the line with the for, or to have content after the colon. The first style is more common, so it says it expects some indented code to follow it. You have an elif at the same indent level. Share. WebDec 20, 2024 · As long as we indent the code correctly as seen in the image below, we can avoid the error: site if site == 'edu': print ('Logging in to Springfield School!') else: print ('Please type the URL again.') print ('You are ready to go!') This code will result in the “IndentationError: expected an indented block”. By adding the following ... subway judson rd longview tx