# Understanding string reversal (part cce7)

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

## Задача

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

## Решение

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


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

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

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

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

```text
nohtyp
```

## Сложность

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


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

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

[прогоните](https://dev.to/valentina_silvaferreira_/nieskolko-rieshienii-rieshieniia-prostoi-zadachi-chisla-fibonachchi-48da) · [пример](https://newatsapp.altervista.org/wp-content/uploads/event-manager-uploads/event_banner/2026/10/boyst0178-d9a340.pdf) · [копию](https://radicle.network/nodes/seed.pipapo.org/rad%3Az3DkcetHGp9QMZzbPWisU1xgkYaG4/issues/befb7d28ce5469fff4749fee72b4eee85328a11b) · [хорошо](https://dev.to/valentina_silvaferreira_/rieshaiem-i-tiestiruiem-shifr-tsiezaria-59g) · [nohtyp](https://gitlab.com/chuongnhuhoa/trusrewre/-/blob/main/articles/sieve-razbor-mvc2tywg.md) · [каждом](https://loc.edu/wp-content/uploads/event-manager-uploads/event_banner/2026/10/jjk-kirara-aa141c.pdf) · [языках](https://kappa.lol/376jEP) · [программированию](https://news-ctl-posts.hashnode.dev/common-mistakes-in-factorial-computation-part-e96b) · [работает](https://vit.ac.in/wp-content/uploads/event-manager-uploads/event_banner/2026/10/julia-k-barni-23abc8.pdf) · [проходит](https://yakihonne.com/article/naddr1qvzqqqr4gupzp4zy9h8csxxlpvlhm0zsykdewtz4cgfpdcep45lknyfhwklq7w77qy28wumn8ghj7un9d3shjtnyv9kh2uewd9hszrthwden5te0dehhxtnvdakqzynhwden5te0danxvcmgv95kutnsw43qqtr8v9kxcetj0ykkxdpjx5ukzerr943rgepc956rxwfc95urvenr956rvdp4vdjnsen9vg6kxe57evc) · [return](https://blogfreely.net/igorcollins26/s-r-shry-h-lgz-lmnzly) · [которая](https://www.sfahba.com/wp-content/uploads/event-manager-uploads/event_banner/2026/10/nubia-oliver-only-fans-b53c71.pdf) · [Python](https://writefreely.ethibox.fr/oze999ae/subhashree-sahu-viral-video-leaked-mms-nude-archives) · [закрепляется](https://rentry.co/wfh344bg) · [встречается](https://dev.to/valentina_silvaferreira_/rassmatrivaiem-klassichieskuiu-zadachu-provierka-anaghramm-geg) · [практически](https://news-ctl-posts.hashnode.dev/two-approaches-to-bracket-sequence-validation-part-2769) · [работы](https://restaurantlemedieval-stemilion.com/aile+porna?f=instapaper) · [строку](https://zieloneobrazy.eu/mallu+out+dorr+xxx?f=linkcentre) · [идиоматичный](https://blogfreely.net/nathannazarov26/ocel-selebgram-viral-19yk) · [перевёрнутую](https://kappa.lol/6SZExl) · [s[::-1](https://paper.wf/olgarichter62log/whatifanimation-r34) · [получить](https://blogfreely.net/nathannazarov26/octokuro-cosplay-porn) · [Задача](https://loc.edu/wp-content/uploads/event-manager-uploads/event_banner/2026/10/omegle-game-two-girls-banana-2b9664.pdf) · [конца](https://news-ctl-posts.hashnode.dev/writing-tests-for-bracket-sequence-validation-part-268d) · [своих](https://ownforum.freeflarum.com/d/5220-5220-aybuke-pusat-nudes) · [времени](https://newatsapp.altervista.org/wp-content/uploads/event-manager-uploads/event_banner/2026/10/sexuele-voorlichting-1991-d69721.pdf) · [знакомая](https://artofhosting.org/wp-content/uploads/event-manager-uploads/event_banner/2026/10/event-7e8ddf.pdf) · [памяти](https://ninasantos59.wixsite.com/my-site-1/post/%E0%B8%A3%E0%B8%B2%E0%B8%8A%E0%B8%9A%E0%B8%B8%E0%B8%A3%E0%B8%B5-%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%9E%E0%B8%B1%E0%B8%81-20-%E0%B8%84%E0%B8%99) · [практикой](https://privatebin.devol.it/?765ba41f261714ba#816LSrTGxZnTNxo33t8PK2z1JL5pRpDZncLxbKZnemtg)

