Discover a world of knowledge at Westonci.ca, where experts and enthusiasts come together to answer your questions. Discover a wealth of knowledge from professionals across various disciplines on our user-friendly Q&A platform. Experience the ease of finding precise answers to your questions from a knowledgeable community of experts.

When referencing a substring such as str1[m:n] if m >= n then the value will be?

Sagot :

Answer: '' (An empty string)

Explanation:

Normally, when we are getting a substring, we will start from the character at index m and go until, but exclude the character at index n.

If m is greater than n, then we cannot get any substring as we would have to go backwards when we need to go forwards. If m=n, then we still cannot get any characters as we have to exclude the character at index n, making us have to exclude the character at index m as well.

Hence, for both situations the value would be an empty string, or a string with length 0.