* Added approaches and articles for reverse-string. * Added code snippets for each approach. * remaned files to silence configlet. * renamed article snippets to .md to satisfy configlet. * Apply suggestions from code review Therefor != Therefore. TIL. Added missing link, so should no longer be broken. * Added more on the downfalls and gotchas of unicode. * Wrapping this up for now. * Deleted the Unicode directory for now.
8 lines
226 B
Plaintext
8 lines
226 B
Plaintext
def reverse(text):
|
|
output = list(text)
|
|
start, end = 0, len(text) - 1
|
|
while start < end:
|
|
output[start], output[end] = output[end], output[start]
|
|
start += 1
|
|
end -= 1
|
|
return "".join(output) |