+ 8

I have a doubt ... How list is created using augmented operator ? ..... acc. to me it should have given error

https://code.sololearn.com/ccCYUHD4XHs8/?ref=app

11th Mar 2020, 3:20 AM
Manisha Sahu
Manisha Sahu - avatar
3 Réponses
+ 4
+= is the same as using the method extend. This method takes an iterable and appends each item separately to the list. Since str is also a type of iterable with separate elements, this works.
11th Mar 2020, 9:54 AM
HonFu
HonFu - avatar
+ 9
HonFu Thanks for clearing my concept😊
12th Mar 2020, 3:39 AM
Manisha Sahu
Manisha Sahu - avatar
+ 8
Jay Matthews ls=[ ] ls+='python' print (ls) o/p --> ['p','y','t','h','o','n'] My doubt is ... Why the above code is not giving an error ?
11th Mar 2020, 4:01 AM
Manisha Sahu
Manisha Sahu - avatar