As far as my coding went, list and string indexing felt the same – you could slice them both with my_list[2:5]. But the difference bit me when I tried to change a single letter in a string like a list, and Python threw an error, saying strings are immutable, yaar. It reminds me of my factory's moulds; you can fill them with different plastics, but you can't change the mould itself once it's set – same logic, I suppose.
#exams#study
Jump in to reply — no account needed.