Myntra Interview Question | Reverse String

Question

Write a program in Python to reverse a string without using inbuilt
function reverse string?

in progress 0
TheDataMonk 4 years 5 Answers 1102 views Grand Master 0

Answers ( 5 )

  1. s1 = “swapnil”
    print(s1)
    #output – swapnil
    s2 = s1[::-1]
    print(s2)
    #output – linpaws

  2. reverse_string=string[::-1]
    return reverse_string

  3. return string[::-1]

  4. string = input(“Enter the word: “)
    reverse_string = string[::-1]
    final_output = print(reverse_string)

    Enter the word: Kassandra
    ardnassaK

    Process finished with exit code 0

  5. s=input()
    s=s[::-1]
    print(p)

Leave an answer

Browse
Browse