Skip to content
Advertisement

How to change values in a tuple?

I have a tuple called values which contains the following:

JavaScript

I want to change the first value (i.e., 275) in this tuple but I understand that tuples are immutable so values[0] = 200 will not work. How can I achieve this?

Advertisement

Answer

It’s possible via:

JavaScript

But if you’re going to need to change things, you probably are better off keeping it as a list

Advertisement