B=l.append((l[i]+A+B))
l is a list here and i am trying to append into it more value for it to act as an array . But its still giving me error like list index out of range . How to get rid of it ?
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.
There are many problems in your code:
1) the
appendmethod does not return anything, so it does not make sense to writeB = l.append(...)2) The double parenthesis are confusing, the code you wrote is exactly equivalent to
B.append(l[i]+A+B)3) Finally, obviously, the index
imust be a valid index for the listl, otherwise you will get anIndexErrorexception.