Computer Science, asked by klintonverma1, 9 months ago

Differentiate between mutable and immutable variables in python?

Answers

Answered by dandriyalakanksha200
7

Answer:

a mutable object can be changed after it is created, and an immutable object can't. Objects of built-in types like (int, float, bool, str, tuple, unicode) are immutable. Objects of built-in types like (list, set, dict) are mutable. Custom classes are generally mutable.

Explanation:

Hope it helps plzzz mark as brainliest

Answered by pavithranatarajan855
7

Answer:

Mutable means it can be changeable.

Example list in python

list=[1,2,3]

list.append(4)

output:

[1,2,3,4]

Immutable means we can't change after declared.If we try to change it will throw an error.

Example Tuple,String

tuple=(1,2,3)

tuple.append(4)

output:

It will give type error.

Explanation:

HOPE IT IS HELPFUL .PLEASE MARK ME AS BRAINLIEST!

Similar questions