Sollicitatievraag bij Brane Enterprises (nslhub)

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

Antwoord op sollicitatievraag

Anoniem

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.