0

What is the output of the following code?

Shiv={11,5,7,7,2} Shiv=str(Shiv) print(Shiv[2])

27th Sep 2020, 1:50 PM
chaithanya L
chaithanya L - avatar
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-> ,
27th Sep 2020, 2:07 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
Nasif Rahman can u explain how?
27th Sep 2020, 2:05 PM
chaithanya L
chaithanya L - avatar