0

How 2 can be replaced with 3 here?

Python tuples https://code.sololearn.com/c4Z4EZkWEx88/?ref=app

25th Jul 2021, 5:26 PM
alagammai uma
alagammai uma - avatar
8 Respuestas
+ 4
alagammai uma First convert tuple to list then assign value and again change to tuple mixtuple=(['a',1,True],2,'Science',-5) y = list(mixtuple) y [1] = 3 x = tuple(y) print (x)
25th Jul 2021, 5:42 PM
A͢J
A͢J - avatar
+ 10
Bro you named it tuple still you r asking this question Don't u know tuple is IMMUTABLE !!
25th Jul 2021, 5:53 PM
SωAti
SωAti - avatar
+ 2
alagammai uma Your question and code both are unclear and incomplete.
25th Jul 2021, 5:34 PM
A͢J
A͢J - avatar
+ 1
A͢J thank you
25th Jul 2021, 5:52 PM
alagammai uma
alagammai uma - avatar
+ 1
mixtuple=([‘a’,1,True],2,’Science’,-5) y=list(mixtuple) y[1]=3 x=tuple(y) Print(x)
27th Jul 2021, 5:40 AM
Sriraam SK
Sriraam SK - avatar
0
The element 2 is to be replaced as 3
25th Jul 2021, 5:35 PM
alagammai uma
alagammai uma - avatar
0
Sriraam SK thank you
27th Jul 2021, 5:47 AM
alagammai uma
alagammai uma - avatar
- 2
Swati tuple containing list can be changed
25th Jul 2021, 5:54 PM
alagammai uma
alagammai uma - avatar