0
What is the output of the following code?
Shiv={11,5,7,7,2} Shiv=str(Shiv) print(Shiv[2])
2 Réponses
+ 8
shiv=(11,5,7,2,2)
you convert tuple into a string - str(shiv) - you just need to add “” at the beginning and at the end of a tuple.
So str(shiv)==“(11,5,7,2,2)”. Each character becomes an element of a string.
0-> (
1-> 1
2-> 1
3-> ,
+ 2
Nasif Rahman can u explain how?