Hey all; my question is regarding editing Python code in Notepad++. When I
run this piece of code in Notepad++:

def fix_start(s):
  var1 = s[0]
    var2 = "*"
  var3 = s.replace(var1, var2)

  return var3


I get an indentation error, which reads:


  File "C:\google-python-exercises\google-python-exercises\basic>string1.py
line 56
    var2 = "*"
    ^
IndentationError: unexpected indent


The thing is that in Notepad++, that code does not appear with an
indentation where var2 is. It appears like this:

def fix_start(s):
  var1 = s[0]
  var2 = "*"
  var3 = s.replace(var1, var2)

  return var3

but when I copy and paste it, it pastes with an indentation where var2 is,
which is what I think is causing the error. The code runs fine if I just
use IDLE. I am doing Google's python exercises, and they recommended I edit
the settings on Notepad++ to indent 2 spaces upon a tab, this being the
convention at Google. Does anyone know what the deal is here? Also, I am
wondering why use Notepad++ or other such programs when IDLE seems to be
fine for writing code. Thanks.

-Alex
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to