Asked By – Dawood
I have a tuple called
values which contains the following:
('275', '54000', '0.0', '5000.0', '0.0')
I want to change the first value (i.e.,
275) in this tuple but I understand that tuples are immutable so
values = 200 will not work. How can I achieve this?
Now we will see solution for issue: How to change values in a tuple?
It’s possible via:
t = ('275', '54000', '0.0', '5000.0', '0.0') lst = list(t) lst = '300' t = tuple(lst)
But if you’re going to need to change things, you probably are better off keeping it as a