Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialmoria sos
30 Pointshello can anybody help me please i get this error when i want to run this python code "IndentationError: unexpected ind"
m=[]
r1=[2,4,-6]
r2=[1,3,1]
r3=[2,-4,-2]
r4=[2,-4,-2]
m.append(r1) m.append(r2) m.append(r3) n.append(r4)
def descent(a,b): for k in range(2): piv=a[k][k]
for i in range(k+1,3):
b[i]= b[i]-(a[i][k]*b[k]/piv)
for j in range(k+1,3):
a[i][j]= a[i][j]-(a[i][k]*a[k][j]/piv)
return
def main()
descent(m,n):
for i in range(3):
print(m[i][0],"",m[i][1],"",m[i][2])
1 Answer
Steven Tagawa
Python Development Techdegree Graduate 14,438 PointsIf the spacing that's being shown is accurate, then for j in range(k+1,3):
has to have the same indentation as b[i]= b[i]-(a[i][k]*b[k]/piv)
.
You can only increase the indentation level to mark blocks of code after/inside conditional statements like if
, for
, try
, with
, etc. It's illegal to indent after an assignment (=
) statement.