0
difference between concatenation and string.append() in a list
what is the difference between concatenation and string.append() while both does same operations
3 Réponses
+ 6
Append adds element to the end of the list, concatenation chain elements in order it is.
+ 5
One of the main differences might be that string.append() doesn't exist. Correct me if I'm wrong
+ 2
concatenation means simply add two string and you get new string.
x='solo'
y='learn'
print(x+y) #output=sololearn
and remember here is no append method for string it is uses for list to append the value in the list at last index.
x=[1,2,3]
x.append(4)
print(x) #output=[1,2,3,4]