for i in list:
j = i + 1
print i - j
This will print out -1 times the length of list
What I wanted to do is to print the difference between value i and the next in the list.
Am I clear?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
binds
ito the elements oflist, not its indexes. You might have meantor
Then get the element at index
iwithlist[i].(And please don’t call a list
list; that’s the name of a Python built-in function.)