In order for your script to run "correctly" we need to know what the expected behavior of your script is. In other words, we need the implementer's intent behind the code. Offtopic QA rant: Devs, beware, code will not always explain itself. You'll save yourself a lot of debugging with a few lines of comments.
Now back to your original question.
You post a list of python commands. To me it looks like you try to iterate through a list of strings, print them and then increase the value of the index in your for loop.
Problem here is that you python will not allow you to simply add an integer to a string object.
This piece of code here i+=1
means you are trying to add the integer 1 to the string '1'. Your python interpreter will fail with a TypeError here.
Without full disclosure of intent, this seems like an invalid piece of code that was probably caused by you not understanding how for loops, objects and operators work in Python. I would suggest starting to read up on each subject.
Secondly, you mention a reference to a "wrong syntax" error. No piece of the code you listed would trigger a SyntaxError. Unless we had a piece of crucial information you didnt list: the version of python interpretor you use. See in python 2.7 print
was called with print 'ABC'
while in 3.0 and above the print statement changed to a function and it's called with print('ABC')
. This could indeed trigger a SyntaxError when called in 2.7 interpretor.
Later update
The answer that we expect is "Houston and Houston"
What is the logic that would trigger this expected result? What are you trying to achieve?