Reverse a name

 name = input("Enter your name: ")

reversed_name = name[::-1] print("Reversed name:", reversed_name) In this program, we first ask the user to enter their name using the `input()` function and store it in the `name` variable. Then, we use string slicing with a negative step (`[::-1]`) to reverse the order of the characters in the name, and store the result in the `reversed_name` variable. Finally, we print the reversed name using the `print()` function.

Comments

Popular posts from this blog

Ecommerce website

Yes, Python is an object-oriented programming (OOP) language, but it is also a multi-paradigm language

Your task is to find the missing number.