def reverse_str(revstr: str):
"""Reverses a string. (Can be a number.)"""
if not is_type(revstr, str):
revstr = str(revstr)
chars = []; new_word = ''
for ch in revstr:
chars.append(ch)
chars.reverse()
for ch in chars:
new_word += ch
return new_word
Подробнее здесь: https://stackoverflow.com/questions/796 ... is-shorter
Как я могу сделать это короче? [закрыто] ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение