Aside from what the others have said, there is also no ++ operator in python.
The line for a[i] in a will work, but it has no point and looks awful and confusing.
for a[i] in a
You should add a note to point out that this code is a parody or something.
A nice change to the code would've been to write a = a.append(i). I found that many beginners confuse the return type of the append method.
a = a.append(i)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Aside from what the others have said, there is also no ++ operator in python.
The line
for a[i] in a
will work, but it has no point and looks awful and confusing.You should add a note to point out that this code is a parody or something.
A nice change to the code would've been to write
a = a.append(i)
. I found that many beginners confuse the return type of the append method.