employer cover photo
employer logo
employer logo

Brane Enterprises (nslhub)

Is this your company?

Brane Enterprises (nslhub) interview question

Why in python string is immutable but in cpp it is mutable?

Interview Answer

Anonymous

25 Nov 2023

I said since in cpp a string is array of chars we can iterate it and mutate its value but unlike cpp in python a string is immutable as it is refferenced from the memory as an object so directly we can not mutate a string in python but we can convert it to a list of chars and then we can mutate it.