+ 1

What if tup=(22,3,4,76,-2) tup=str(tup) print(tup[1])

Is there is any change in tuple

20th Mar 2020, 11:39 AM
Programmer
Programmer - avatar
1 Respuesta
+ 1
str(tup) creates a string out of how the tuple looks. It's a totally different sort of object after. First, tup[1] is the second element of that tuple, so 3. Then, tup[1] is the second sign of a string which is '2'.
20th Mar 2020, 11:48 AM
HonFu
HonFu - avatar