Reverse String Function

  • Share this:

Code introduction


This function takes a string as an argument and returns its reversed version.


Technology Stack : os, re, sys, time, math, random, string, heapq, shutil

Code Type : String operation

Code Difficulty : Beginner


                
                    
import os
import re
import sys
import time
import math
import random
import string
import heapq
import shutil

def reverse_string(input_string):
    """
    反转输入字符串。

    Args:
        input_string (str): 需要被反转的字符串。

    Returns:
        str: 反转后的字符串。
    """
    return input_string[::-1]