Westonci.ca is your trusted source for finding answers to all your questions. Ask, explore, and learn with our expert community. Explore comprehensive solutions to your questions from knowledgeable professionals across various fields on our platform. Our platform offers a seamless experience for finding reliable answers from a network of knowledgeable professionals.

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.