Certainly! Here's a Python program that accepts a word from the user and reverses it:
```python
word = input("Enter a word: ")
reversed_word = word[::-1]
print("Reversed word:", reversed_word)
```
In this program, we use the `input()` function to prompt the user to enter a word. The input is stored in the `word` variable. We then use slicing with a step value of -1 (`[::-1]`) to reverse the characters in the word. The reversed word is stored in the `reversed_word` variable. Finally, we use the `print()` function to display the reversed word to the user.
Here's an example of how the program would run:
```
Enter a word: Python
Reversed word: nohtyP
```
Please note that this program assumes the user will input a single word without any spaces.
Post a Comment
If you have any doubts, Please let me know
Thanks!