I’d like to edit some elements in python’s list inside a loop. How can I make a proper loop for this? This code doesn’t work:
for i in X:
i=(i-C1)/C2
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.
Use a list comprehension:
And a minor point, the Python Style Guide recommends using all lower case for your variable names, e.g.:
Capital letters are usually used to start class names (and all-capitals denotes a constant).