0

what is the output of this code and how ?

lst=["1","2","3"] lst[ : ]="999" print(lst)

24th Jul 2020, 5:59 AM
Bilal Saifi
Bilal Saifi - avatar
2 Respuestas
+ 5
This is basically the same as: lst = list("999") It takes an iterable and appends each of its value to the list, in this case "999" is iterable so the list will become: ['9', '9', '9']
24th Jul 2020, 6:04 AM
Bagon
Bagon - avatar
+ 3
It print ["9","9","9"] It is because lst takes value one by one from string and make list . Here lst[ : ] means starting index value 0 to end .
24th Jul 2020, 6:06 AM
Sâñtôsh
Sâñtôsh - avatar