We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
There's an error with your code reversed
def reverse(s): new_str = "" for i in range(len(s)): new_str += s[i*-1] return new_str
This return
reverse('choco') 'cocoh' reverse('cats') 'csta'
And it's wrong because python Index start at 0 and 0*-1 = 0
A workaround could be
def reverse(s): new_str = "" for i in range(len(s)): if i == 0: new_str += s[-1] else: new_str += s[(i+1)*-1] return new_str
The text was updated successfully, but these errors were encountered:
No branches or pull requests
There's an error with your code reversed
This return
And it's wrong because python Index start at 0 and 0*-1 = 0
A workaround could be
The text was updated successfully, but these errors were encountered: