Running the python code(with out any syntax,type error) but it always show me a indented block error.tell why and how to avoid | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Running the python code(with out any syntax,type error) but it always show me a indented block error.tell why and how to avoid

def func(x,y): return x+y x=str(input(":")) y=str(input(":")) print(func(x,y))

21st Jul 2019, 4:03 AM
Yogeshwaran
2 Answers
+ 1
Ur getting Bcz of wrong indentation. Correct the indentation of all if, and else conditions, u will get proper answer..!! Python uses indentation (white space at the beginning of a line) to delimit blocks of code. Other languages, such as C, use curly braces to accomplish this, but in Python indentation is mandatory; programs won't work without it. Ex: Correct the indentation in return statement. def func(x, y) : return (x+y) # Give a tab to get proper indentation... Hope this helps....!!!
21st Jul 2019, 4:57 AM
Kuri
Kuri - avatar
0
def func(x,y): return x+y
21st Jul 2019, 4:58 AM
Diego
Diego - avatar