List VS tuples
One question that is often asked is, "Why should we differentiate between tuples and list variables?" The question can also be expressed as "do we really need two similar sequence types?" , one reason is that in some cases, using one of these types is preferable to using a different type. One of the best ways to use immutable type variables is if you are maintaining some sensitive data, and you need to pass that data on to a function that you do not understand (perhaps an API that is not written at all), as an engineer who is only responsible for a certain part of the software, if you are sure that your data will not be tampered with by the calling function , you will feel a lot safer.
An example of a parameter that requires a mutable type is if you are managing a Dynamic data collection. You need to create them first, add them gradually or irregularly, or sometimes remove individual elements. This is a typical example of a variable type object that must be used. Fortunately, with the built-in list () and tuple () conversion functions, you can easily convert between the two.
The list () and tuple () functions allow you to create a tuple with a list, and vice versa. If you have a tuple variable, but you need a list variable because you want to update its object, the list () function is your best helper. If you have a list variable, And you want to pass it to a function, maybe an API, and you don't want anyone messing up your data, then the tuple () function is very useful.
Python basic notes-sequence of data types (3)