CodeSolved

A comprehensive source of programming questions and exercises

Reverse the string (String)

Practice Easy 16/ Download 1012 Views

Write a function that receives a string (String) as input and reversed it

Example

Reverse ('Amir') # RIMA
Reverse ('Hello') # Olleh

10 Answers

X=(input("x: "))
def txttt():
    TXT=X[::-1]
    print(TXT)     
txttt()
Farbod.313 Download Python
user=input("Enter ant word you want: )
print(user.reversed())
User 1496 Download Python
def reverse(str):
    reverse_str = str[::-1]
    return reverse_str
string = input("enter your text: ")
print(reverse(string))
Amirgr Download Python
def reverse(text):
    return reversed(text)
char = (input('number : '))
print(*reverse(char))
class Words:
    def __init__(self, word):
        self.word = word
    
    def print_word(self):
        return self.word[::-1]

word = input("enter your word: ")
obj = Words(word)

print("کلمه برعکس:", obj.print_word())
Roghaye.m Download Python
def reverse(string):
    return string[::-1]
# Examples
print(reverse('amir'))  # rima
print(reverse('hello'))  # olleh
User 136 Download Python
while True:
    string = input("enter your str:")
    if string == "0":
        print("end")
        break
    x = string[::-1]
    print(x)

Submit answer

Submitting answers is currently unavailable.

Related content

Detection using AI
×
×
Close