String reversal

Question

Write a program to reverse the string, passed as an argument.

in progress 0
YashikaKhurana 4 years 2 Answers 823 views Master 0

Answers ( 2 )

  1. def reverse(my_string):
    return my_string[::-1]

    print(reverse(“hello”))

    Output : olleh

  2. def revString(string):
    return string[::-1]

  3. def reverse_string(string):
    return string[::-1]

  4. def reverseS(string1):
    return string1[::-1]

Leave an answer

Browse
Browse