+ 3
Why different output???
2 Réponses
+ 6
In the first case in ur code, you're iterating over a range of indices (even though there is just one).
Therefore, list[a:b] returns the result as a list, even if b=a+1.
Thus, all you're doing is putting element 3 in a list, then just getting back element 3 from that list.
In the below case, you're specifically choosing to get element 3, which will be returned without being put in a list, so from there you access the 0th element of the resulting variable.
+ 5
The same question posted twice, although the code seems to be slightly modified (probably)
https://www.sololearn.com/Discuss/1688344/?ref=app