Skip to content

Fix for issue #265 (Day 4: Strings)#266

Closed
AdityaDanturthi wants to merge 76 commits intoversion-2019.12.22from
master
Closed

Fix for issue #265 (Day 4: Strings)#266
AdityaDanturthi wants to merge 76 commits intoversion-2019.12.22from
master

Conversation

@AdityaDanturthi
Copy link
Copy Markdown
Contributor

@AdityaDanturthi AdityaDanturthi commented Jul 26, 2022

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)

@Asabeneh Asabeneh closed this Jul 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.