+ 1
How it works?
dont understand why i can add 'str' but cant 'int'. https://code.sololearn.com/csjsCNefgCY0/?ref=app
3 Answers
+ 5
or n[1:1] = "1"
list and strings are iterable.
1 is an integer an not iterable.
The types of the items in the list of the left side dont matter.
+ 2
It not depends on int... For append slice you must use a Iterable object (and string its)... Try with:
n[1:1]= [1]
Here you use a list (thats an iterable object) when you cant get errors
+ 1
i forgot about iterable.. for 'append' ))) thanks