x = ("apple", "banana", "cherry")
y = list(x)
y[1] = "kiwi"
x = tuple(y)
print(x)
x = ("apple", "banana", "cherry")
y = list(x)
y[1] = "kiwi"
x = tuple(y)
# Change Value In Tuple :-
friends = ("Mido", "Lucifer", "Abdelrhman")
# Example => Wanna Change ( Abdelrhman ) To ( Aiiob );
# First We Need Transformation From Tuple To List ,
# We Need To Create Variable With Any Name
# After This We Use list() Function
oneName = list(friends)
# After This We Need Change The Value ,
oneName[-1] = "Aiiob"
# After This We Need Transformation From List To Tuple ,
# We Use tuple() Function
friends = tuple(oneName)
# And We Done (:
# i want to change index 2 to a value of 200
t = (1, 2, 3, 4, 5) # a random tuple
# if we just do t[2] = 200, it will result in an error as tuples are immutable
t = list(t)
t[2] = 200
t = tuple(t)
# this changes our tuple to a list, changes the value,
# and converts it back to a list