[Python] How can I make this shorter? [closed]

Discussão em 'Python' iniciado por Stack, Junho 13, 2025.

  1. Stack

    Stack Membro Participativo

    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

    Continue reading...

Compartilhe esta Página