MUTABLE AND IMMUTABLE OBJECTS
Elementary forms of data such as numeric and Boolean are called scalar data types. Several applications require more complex forms of data, for example, the name of a person, coordinates of a point, a set of objects, or a list of personal records of individuals. In the previous chapter, we discussed about strings (type str – an immutable structure). In this chapter, we will discuss some other mutable and immutable objects, namely, lists, tuples, sets, and dictionaries.
A list is an ordered sequence of values. It is a non-scalar type. Values stored in a list can be of any type such as string, integer, float, or list, for example, a list ...