Code syntaxis problem


#1

I undenstand this is the correct code (This ■■■■ does not let me indent the code):
def double_list(x):
----for i in range(0, len(x)):
--------x[i] = x[i] * 2
----return x
print double_list(n)`

but why this does not work?

def double_list(x):
----for i in x:
--------x[i]*=2
----return x
print double_list(n)`



#2

@microsolver01707,

Please re-edit your Post

  • leave one blank-line above of your code
  • select your code in the Post
  • then =click= on the </>-symbol-of-this-editor

Your code will then be in a pre-code state
and you will be able to make/present the proper indentations.

or even better use
= http://discuss.codecademy.com/t/using-backticks-to-format-your-code/3697
[extra's]
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet


#3

@microsolver01707,

https://docs.python.org/2/tutorial/index.html