
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Python Program to Reverse a String without using Recursion
When it is required to reverse a string without using recursion technique, simple negative indexing can be used.
Indexing helps the values to access the elements at a specific index.
Example
Below is a demonstration for the same −
my_string = str(input("Enter a string that needs to be reversed: ")) print("The string after reversal is: ") print(my_string[::-1])
Output
Enter a string that needs to be reversed: Jane The string after reversal is: enaJ
Explanation
- The string input is taken by the user.
- This value is assigned to a variable.
- It is displayed on the console.
- It is negative indexed and displayed on the console.
- Related Articles
- Python Program to Reverse a String Using Recursion
- Java program to reverse a string using recursion
- Python Program to Reverse a Stack using Recursion
- Python Program to Display the Nodes of a Linked List in Reverse without using Recursion
- Write program to reverse a String without using reverse() method in Java?
- Python Program to Flatten a List without using Recursion
- C++ program to Reverse a Sentence Using Recursion
- Java Program to Reverse a Sentence Using Recursion
- Haskell Program to Reverse a Sentence Using Recursion
- Golang Program to Reverse a Sentence using Recursion
- Write a C program to Reverse a string without using a library function
- Python Program to Find the Fibonacci Series without Using Recursion
- Python Program to Print All Permutations of a String in Lexicographic Order without Recursion
- Java Program to Find Reverse of a Number Using Recursion
- Python Program to Display the Nodes of a Linked List in Reverse using Recursion

Advertisements