-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Day 4: Strings #265
Comments
AdityaDanturthi
added a commit
to AdityaDanturthi/30-Days-Of-Python-1
that referenced
this issue
Aug 9, 2022
### Fix for issue Asabeneh#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`)
Closed
Still open |
Repository owner
locked and limited conversation to collaborators
Jul 8, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In the find() example
if find() returns the position first occurrence of 'y', then shouldn't it return 5 instead of 16?
The text was updated successfully, but these errors were encountered: