Expected an indented block means?? Who to solve | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Expected an indented block means?? Who to solve

def multiply(x, y): return x * y a = 4 b = 7 operation = multiply print(operation(a, b)) IndentationError:expected an indented block

1st Jul 2018, 3:35 AM
Moghan kumar
Moghan kumar - avatar
3 Answers
+ 6
We can help you better if you save your code in the playground and then post a link here. I copied and pasted your code and it worked fine! https://code.sololearn.com/c12UZLYfBGY4/?ref=app
1st Jul 2018, 3:50 AM
David Ashton
David Ashton - avatar
+ 2
Moghan kumar You see, unlike other free-form languages such as JS, C++,C# etc. Python is not free-form In python, you don't use Curly braces to denote body of functions, rather you use indentations, meaning spaces at the start of a new line. Eg Check out these:: Indented. Indented. You see the difference right. So when defining functions, always be sure to indent function bodies. Eg def printName(): print("D'lite") ..... Good def printName(): print ("D'lite") ..... Bad If you don't indent them, you'll get those IndentationsExpected errors
1st Jul 2018, 3:51 AM
Dlite
Dlite - avatar
+ 1
Use Tabs instead of Space...
1st Jul 2018, 11:35 AM
Cat9
Cat9 - avatar