# Walking through string reversal (part 868c)

Разберём задачу, которая встречается практически в каждом учебнике по программированию.

## Задача

Перевернуть строку: из `"python"` получить `"nohtyp"`. Задача-разминка, знакомая каждому новичку.

## Решение

```python
def reverse_string(s: str) -> str:
    return s[::-1]


print(reverse_string("python"))
```

## Как это работает

Срез `[::-1]` проходит строку с конца с шагом -1 и создаёт перевёрнутую копию. Это идиоматичный способ в Python; в других языках тот же результат даёт цикл от конца к началу.

## Пример работы

```text
nohtyp
```

## Сложность

O(n) по времени и памяти.


Такой пример хорошо закрепляется практикой — перепишите решение руками и прогоните на своих тестах.

**Читайте также:**

[прогоните](https://paper.wf/clara1987log/uncover-the-hidden-treasure-of-big-titted-pakistani-girls) · [Пример](https://news-ctl-posts.hashnode.dev/solving-and-testing-string-reversal-part-39f3) · [решение](https://articlescad.com/edupage-account-379345.html) · [других](https://dev.to/valentina_silvaferreira_/rassmatrivaiem-klassichieskuiu-zadachu-provierka-anaghramm-geg) · [проходит](https://paper.wf/diana1983log/yin-bu-te-xie) · [конца](https://rentry.co/thivid-269870) · [Python](https://rentry.co/gallery-610605) · [новичку](https://blog.spikyhair.club/oz23c982/sinem-kobal-nude-hot-pics-and-sexy-photo-gallery) · [тестах](https://paste2.org/CB5NVNUO) · [Разберём](https://loc.edu/wp-content/uploads/event-manager-uploads/event_banner/2026/10/aslihan-kapansahin-8494b0.pdf) · [идиоматичный](https://cultmtl.com/wp-content/uploads/event-manager-uploads/event_banner/2026/10/cg-cc3d74.pdf) · [Задача](https://newatsapp.altervista.org/wp-content/uploads/event-manager-uploads/event_banner/2026/10/big-tits-milf-married-stepsister-gets-fu-57b41f.pdf) · [программированию](https://kappa.lol/uST8vr) · [хорошо](https://archive23846.mataroa.blog/blog/2024/) · [практически](https://rentry.co/wruticrb) · [памяти](https://dev.to/valentina_silvaferreira_/rieshaiem-i-tiestiruiem-shifr-tsiezaria-59g) · [началу](https://contracosta.news/wp-content/uploads/event-manager-uploads/event_banner/2026/10/manuelahcadavid-27a3a1.pdf) · [своих](https://sway.cloud.microsoft/VNzA1rgFS0Ugrfmo) · [создаёт](https://news-ctl-posts.hashnode.dev/walking-through-minimum-and-maximum-of-a-list-part-c490) · [Сложность](https://discuss.tchncs.de/post/65444578) · [работы](https://dev.to/valentina_silvaferreira_/nieskolko-rieshienii-rieshieniia-prostoi-zadachi-chisla-fibonachchi-48da) · [s[::-1](https://ikue.work/sunny+leone+x+video+in?f=linkcentre) · [руками](https://jaflysilve.freeflarum.com/d/1147-1147-sujatha-simhadri-tango-leaked-video-hot-nude-photos)

