Files
python/exercises/practice/reverse-string/.approaches/list-and-join/snippet.txt
BethanyG 93744302aa [Reverse String]: Add Approaches, Performance, and Unicode Articles (#3609)
* 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.
2025-02-14 18:32:13 -08:00

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)