There’s a list as follows: list = [].
and then assuming x = 'A', what does list = list + [x] mean? Is that only for characters? If so, how can it be adapted for integers?
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.
lis=lis+[x]means add'a'to[]and then store the new list['a']inlison the LHSbut doing it this way creates new object everytime:
Better use
lis+=[x]orlis.extend(x)