❓ Interview question
Why are strings immutable in Python?
Answer:Because once a string is created, its value cannot be changed. This ensures that strings can be safely used in hashing, as dictionary keys, and in multithreaded environments without causing data corruption. Instead of modifying the string , Python creates a new string object when any operation changes it. This behavior improves performance and security but requires more memory for frequent modifications.
tags: #interview #python #strings
By: t.iss.one/DataScienceQ 🚀
Why are strings immutable in Python?
Answer:
tags: #interview #python #strings
By: t.iss.one/DataScienceQ 🚀
❤1