Computer Science
What is the internal structure of python strings ?
Python String Manipulation
2 Likes
Answer
Strings in python are stored as individual characters in contiguous memory locations, with two-way index for each location. The index (also called subscript) is the numbered position of a letter in the string. Indices begin 0 onwards in the forward direction up to length-1 and -1,-2, …. up to -length in the backward direction. This is called two-way indexing.
Answered By
1 Like
Related Questions
Assertion. Dictionaries are mutable but their keys are immutable.
Reason. The values of a dictionary can change but keys of dictionary cannot be changed because through them data is hashed.
Assertion. In Insertion Sort, a part of the array is always sorted.
Reason. In Insertion sort, each successive element is picked and inserted at an appropriate position in the sorted part of the array.
Write a Python script that traverses through an input string and prints its characters in different lines — two characters per line.
Discuss the utility and significance of Lists in Python, briefly.