30-Days-Of-Python icon indicating copy to clipboard operation
30-Days-Of-Python copied to clipboard

Fix for issue #265 (Day 4: Strings)

Open AdityaDanturthi opened this issue 3 years ago • 0 comments

Fix for issue #265

find(): Returns the index of the first occurrence of a substring, if not found returns -1 challenge = 'thirty days of python' print(challenge.find('y')) # 5 instead of 16 (since the index of the first 'y' is 5) print(challenge.find('th')) # 0 instead of 17 (since the index of the first 'th' is 0)

rfind(): Returns the index of the last occurrence of a substring, if not found returns -1 challenge = 'thirty days of python' print(challenge.rfind('y')) # 16 instead of 5 (since the index of the last 'y' is 16) print(challenge.rfind('th')) # 17 instead of 1 (since the index of the last 'th' is 17)

AdityaDanturthi avatar Jul 26 '22 00:07 AdityaDanturthi