List = ["I?", "Can", "!Not", "Do.", "It"]
l=[]
BadChars = ["?", "!", "."]
for i in List:
for j in BadChars:
if j in i:
i=i.strip(j)
l.append(i)
print(l)
print(List)
Output:
As you can see in the output the list was not overwritten even if the wrote i=i.strip(j). What is happening? Thanks in advance. I am newly learning python so this question may be dumb. This question raised in my mind when i was solving Change Character in Sublist in Stack Overflow. My question is "Why is List and l are having different values?"