for summation of two matrix i wrote this code:
def sum_mat(a,b):
for i in range(len(a)):
for j in range(len(a[0])):
c=a[i][j]+b[i][j]
a=[],b=[]
return(c)
c=[]
a=[[2,3],[-1,4]]
b=[[1,1],[2,2]]
print(c)
but i got a intended block.what is problem?
Hey there, welcome to the forums!
If you’re getting an expected an indented block
error, it means you’ve not indented your code properly somewhere.
Remember that in Python, we don’t use curly braces { }
to demarcate function code blocks. Instead, whenever we are defining a new block of code - for example a function or a for loop - we indent the code inside the block, like so:
global_variable_1 = "some random text"
def do_stuff():
""" im inside a function so i must be indented! """
results = []
for i in range(10):
# i'm inside a for loop now, so I need to indent again!
results.append(i ** 2)
return results
Hopefully you’ll be able to spot your error… but I’ve left you a hint just in case. 
@mostafaghorbani06437, I edited your post to preserve your original code formatting in order to provide some clarity. Please review the guidelines here for future posts. Now that we can see your original formatting, you have a few issues. Refer to @thepitycoder’s post for tips on indenting Python code. Also note that indentation must match for code within the same block:
#proper indentation
def some_function():
a = 1
b = 2
return a + b #returns 3
#throws IndentationError: unindent does not match any outer indentation level..
def some_function():
a = 1
b = 2
return a + b
After addressing the indentation, you’ll need to work on the code itself if you are wanting it to sum two matrices.