What do you mean by mutable and immutable data type? Explain

Question

Why did you ask a definition here?
Well, it’s very important to understand the concept of mutable and immutable data types. Any good product based company will love to play with
mutable and immutable
indexed and unindexed
ordered and unordered data type

Don’t copy paste definition, just try to keep it simple

solved 2
TheDataMonk 3 years 37 Answers 1807 views Grand Master 0

Answers ( 37 )

    -1

    List are mutable , topples are not mutable.

  1. Mutable data types are the ones which can be changed and immutable are the ones which cannot be changed. Mutable examples- set,list
    immutable examples- int, char, float etc

  2. Mutable datatypes are the one which can be changed and immutable are the ones which cannot be changed. Immutable are inbuilt data types. For ex- mutable- list, set. Immutable example- int, float etc

  3. Mutable datatypes are the ones which can be changed and immutable are the ones which cannot be changed . Immutable are the inbuilt data types. Ex of mutable- set, list. Ex of mutable- int, float

    4

    Mutable data types are the data types in which we can edit data ie insert or remove or extend data whenever we want using a dot operator and different modules; example list. Immutable data types are the ones in which we can’t make any changes, neither can we remove or add any data; for example Tuple. Anyway, list and tuple both are indexed data types but in a tuple, it’s just representation to access values for different uses but in the list, we can append or do anything we want.

    Best answer
  4. Mutable data types in python are those which can be changed, once created but immutable objects are those which cannot be changed, once they are instantiated.
    Example of mutable data types are list, dictionary, set, user-defined classes.
    whereas examples of Immutable datatypes or objects are int, float, string, bool, tuple.

  5. Mutable means if we fill the data in a list that can be changeable but in Immutable we can not change the data after execution.

  6. Contents of Mutable objects can be modified whereas immutable cant be.

  7. Mutable datatypes can be edited later but immutable datatypes cannot be edited later.

  8. All the data in python is represented as objects.

    Objects whose value can be changed after it is created is called mutable. Example: list, dictionary, set and user-defined classes.

    Objects whose value cannot be changed once it is created is called immutable. Example: int, float, decimal, bool, string and tuple.

  9. Mutable data type: Mutable data type is the type of data which can be changed once created or updated as per our requirement. List, dictionary, set, are the example of mutable data type.
    Immutable data type: immutable data type is type of data we can’t be changed once executed. Examples of Immutable datatypes are int, float, string, bool, tuple.

  10. Mutable: Mutable data types are type of data which can be changed once executed. List & set are example of the mutable data type.
    Immutable data type:- Immutable data types are type of data which can’t be changed once executed. Tuple, float, int, str are the example of immutable data types.

  11. When it comes to calculating variance in sample we divide it by (n-1) instead of n as we do it in population. When it comes to sample , we take only a portion of all the samples and that somehow underestimates the effect of all parameters which can be proved by experiments.
    So to negate this effect , we divide it by a slightly lesser value, in this case ( n-1) , so when the denominator shrinks, the overall value of the variance increases and it comes closer to the value of population variance.

  12. Mutable datatype means the elements in the datatype can be changed and immutable means datatypes cannot be changed.
    Mutable : list,set…
    Eg.
    list1 =[10,20,30]
    list1[1] = 30
    print(list1[1])
    Immutable: tuples,string
    list1 =(10,20,30)
    list1[1] = 30
    print(list1[1])
    it shows error

  13. mutable— which can be changed eg—- list, dict, set
    immutable— which cannot be changed eg—- tuple
    ordered—output will be in same order as they are initially specified eg—list, tuple, string
    unordered— output will be not in the same order as they are specified initially eg–dictionary, set
    indexing–which can be accssed by index
    unindexing–which can not accessed by indexing(nested list does not support indexing)

  14. Mutable datatypes are those which can be updated or modified after creation, such as list. We can insert , delete or edit data of same variable after creating a list variable.
    Immutable datatypes are those which cannot be updated or modified after creation i.e., if we perform any mutable operations, it will show error. Examples of this include string, tuple. These cannot be modified after creation , the only way is to recreate them again.

  15. Mutable data types are those which once are defined, then after can be changed or re defined such as data stored in list[ ]
    whereas immutable data types once defined can not be changed again, example tuples().

  16. Mutable Data Types : All those data types which can be changed or are liable to change. List, Dictionary and Set are some examples

    Immutable Data Types: Data types which cannot be changed or the data types which cannot be altered in any ways. Float, Int, String are some exaamples

  17. Mutable data type: eg: List, they can be edited/altered later
    Immutable data type: eg: Tuple, once formed they can not be changed

  18. Mutable data types can be altered/changed once the variable is defined, whereas immutable datatypes cannot be altered/changed post the variable definition.

    Mutable datatype – list, dictionary
    Inmutable datatype – string, tuple, frozen set

  19. A data structure is said to be mutable if it’s values can be changed or updated. For example, a list is mutable. Suppose we have
    ls=[2,4,5,5]
    If we wish to change value 4 in the list, we can easily do that in the following way:
    ls[1]=10
    A data structure is immutable if it’s values cannot be changed or updated. A tuple is immutable. We use an immutable datatype to store values which we do not want to change during the entire execution.

  20. Mutability is about whether or not we can change an object once it has been created. If an object (like a list or string) can be changed (like a list can), then it is called mutable. However, if an object cannot be changed without creating a completely new object (like strings), then the object is considered immutable

  21. Mutable data types are those which can be reassigned other values without making a new object.
    For eg- List : l =[a,b,c] . We can make changes in the same list, l[a] = 100. So now, l = [100,b,c]

    Immutable data types are those which can’t be changed like tuple.
    In a tuple ,t = (d,e,f) , the values can’t be indexed or changed.

  22. Mutable datatypes are those whose size or content can be changed after their creation. e.g. list, dict, set.
    Immutable datatypes are those whose size or content can’t be changed after their creation. New objects are created if we try to change them. e.g. string, tuple

  23. Mutable data types-They are objects which can be modified even after it’s creation. Modifications can be like adding, deleting, or replacing an element. For example-In Python: Lists, Dictionaries, Sets and Arrays(Numpy)
    Immutable data types-The objects cannot be modified after they get created; For example-Strings, tuple, float, decimal, bool, and range.

  24. An object in a python has three dimensions its identity, type and value.
    Any object in python whose value can be changed at any point of time are called mutable data type whereas those datatypes whose value cannot be changed once they are created are called immutable datatypes
    Immutable data types includes data types like dictionary, list, user defined
    Mutable data types are int, float, boolean, tupple, string, tupple etc

  25. An object in a python has three dimensions its identity, type and value.
    Any object in python whose value can be changed at any point of time are called mutable data type whereas those datatypes whose value cannot be changed once they are created are called immutable datatypes
    Immutable data types includes data types like dictionary, list, user defined
    Mutable data types are int, float, boolean, tupple, string, tupple etc.
    Whenever we try to change the value of immutable datatype the another variable is created to accommodate the change

  26. List, dictionary, set are mutable data types which can change their state and content

    Int, float ,bool, string are immutable data types as they cannot change their state once created

  27. Immutable means that the thing cannot be changed (or updated) – like tuples in Python. you cannot append anything to them.
    Mutable, such as lists, can be changed or updated. A list can have new values appended to it, hence being mutable.

  28. Whenever an object in Python is instantiated, a unique id is assigned to it. The objects that can be modified at a later stage in the program are called mutable objects and the type of data that they hold is also mutable. The data types of such objects is said to be mutable.
    Now, we may even have objects that cannot be modified at a later stage and the data type of such objects is said to be immutable.
    For instance, tuples are immutable while lists and dictionaries are mutable.
    This is because we can insert or delete or update any value in lists or dictionaries but the same cannot be done in tuples.

  29. Mutable: As the name suggests this data type can be updated, altered. for ex list, dict. are Mutable
    Immutable: The data can’t be altered, the value can be accessed but can’t be altered. Ex Set,String

  30. Mutable: As the name suggests this data type can be updated, altered. for ex list, dict. are Mutable
    Immutable: The data can’t be altered, the value can be accessed but can’t be altered. Ex tuple,String

  31. Mutable data types can be changed anywhere in your program.
    e.g – List, dictionary, set
    Immutable data types can not be changed later in the program.
    e.g- string, tuple

  32. mutable-the datatype one which can be altered or transformed (list,dict)
    immutable-cannot be altered or transformed(tuple)

  33. Mutable datatypes are those which can be edit, like you can add or subtract elements in it. Example: List and dictionary.
    Immutable datatypes can not be mutated, that is you cannot edit, example: float, int you cannot edit them.

  34. We have two types of data mutable and immutable. If we can change the values of any data type we called it mutable and if we can’t change the values of any data type we called it immutable. For example list – we can Modify the values of list after creating list like list1[2] = 4 so it is called mutable but same we can’t do with tuples so it is called immutable. List, dictionary are mutable and tuples, string are immutable.
    Thank you

  35. Mutables data types can be changed once created eg( list, set , etc ) and Immutable data types cannot be changed. eg(int, float, bool etc)

Leave an answer

Browse
Browse