Explain immutability in python this point in hindi

immutability point plz explain in hindi.

1 Like

An object is immutable when its state doesn’t change after it has been initialized. For example, String is an immutable class and, once instantiated, the value of a String object never changes.

1 Like

Hi dear sure i will make you understand that in hindi or me apko hindi me samjhati hoon ye topic-
python me Immutability ek important property hai jise data or objects ko ek baar banaya ja sakta hai or uske bad usme koi bhi change nhi kiya jaa sakta hai bilkul bhi matlab ki jaisi hi data ya objects ek baar tayar ho jati hai wo sthayi ho jati hai.

example of tuple -

my_tuple = (1, 2, 3)
print(my_tuple) # output: (1, 2, 3)

tuple me koi change nhi kiya ja sakta

#niche diye line ko chalne me problem hogi

my_tuple[0] = 10

immuntability example string

my_string = “Hello”
print(my_string) # output: Hello

#string me koi change nhi kiya ja sakta
#below line ko chalane me problem hogi

my_string[0] = “J”

asha karti hoon apko samaj me aa gaya hoga :smiley: :smiley: