IDNLearn.com is your go-to resource for finding precise and accurate answers. Find in-depth and accurate answers to all your questions from our knowledgeable and dedicated community members.

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.