0

Expected an indented block Error

Hi I recently start to learn python 😃 but I have a problem. I was coding in python, suddenly gave me Indentation Error. I don't know how to solve it. I erase codes and write them again but didn't solve.

11th May 2021, 5:34 PM
Sahar Saberijamal
Sahar Saberijamal - avatar
4 ответов
+ 1
Hi! Indentation is a important concept in Python, and gives your code a structure; make it more easy to read and understand. You have to use it for example when you use compound statements: if ####: ####### ## ##### elif ####: #### ##### else: ##### ####### def ####(): ###### ######## ####### The indentation consists of the spaces between the begining of the line and where the code on the line actually starts. Usually four spaces are used as indentation spaces, and it is important to be consistent (allways use four spaces). It is possible to use tabs instead of spaces, but don’t mix tabs and spaces.
11th May 2021, 6:36 PM
Per Bratthammar
Per Bratthammar - avatar
+ 2
Per Bratthammar It solved!!! 😃 Thank you so much.
12th May 2021, 10:15 AM
Sahar Saberijamal
Sahar Saberijamal - avatar
+ 1
post the link to your code. So, it'll become easy to solve your problem.
11th May 2021, 5:40 PM
sarada lakshmi
sarada lakshmi - avatar
+ 1
Setup your code editor with your preferred indentation level and use tab from the keyboard not the space key to indent in block of code.
11th May 2021, 7:32 PM
HBhZ_C
HBhZ_C - avatar