0
I have this doubt.
colors=["red","green"] colors.extend("blue") print(colors) Output is = ['red','green','b','l','u','e'] Why the blue is appended like this why it's not 'blue'
2 Respuestas
+ 2
extend expects an iterable argument . when you pass it a string, it iterates over it and returns each char at a time.
if it were colors.extend(["blue"])
it would output what you expected.
+ 1
bahha🐧 Thanks bro. I got it.