You cannot change a tuple that has been initialized once, but you can assign a new value to the variable that contains the tuple. What this means is
t = ('A', 'B', 'C')
('A', 'B', 'C')
cannot be changed in . However, you can assign a new value to t
. For example,
t = ('A', 'B', 'C')
t += ('D')
('A', 'B', 'C')
cannot be changed like this, but
t = ('A', 'B', 'C')
t = t + ('D',)
In this way, t can be assigned a new tuple called ('A', 'B', 'C', 'D').
© 2024 OneMinuteCode. All rights reserved.