Why am I getting an indentation error, "unexpected indent" in my code? Python -
on first line of code, seem getting indentation error. have 2 spaces indent on code, since class requires it, first time i'm getting error it.
my code looks @ start.
import math def main():
you should not indent python code unless have def, for, if , similar such things preceding indentation block.
eg:
for thing in variable: #indent code pass def afunction(): #indent pass #invalid indentation: def afunction2(): pass as can imagine, code not becomes hard human eyes interpret, machine interpret because cannot realise indentation starts or ends.
speak teacher this, might using interpreter allows them indent entire script particular amount. never recommend though.
Comments
Post a Comment