Why am I getting an indentation error, "unexpected indent" in my code? Python
Question: On the first line of my code, I seem to be getting an indentation error. I
have 2 spaces as an indent on my code, as I always do since my class requires
it, but for the first time I'm getting an error for it.

My code looks like this at the start.

    
    
      import math
    
      def main():
    


Answer: You should not indent python code unless you have something like `def`, `for`,
`if` and similar such things preceding the indentation block.

Eg:

    
    
    for thing in variable:
      #indent code
      pass
    
    def aFunction():
      #indent
      pass
    
    #invalid indentation:
     def aFunction2():
      pass
    

As you can imagine, the code not only becomes hard for human eyes to
interpret, but also for your machine to interpret because it cannot realise
where the indentation starts or ends.

Speak to your teacher about this, they might be using an interpreter which
allows them to indent their entire script by a particular amount. I would
never recommend this though.

