This content originally appeared on DEV Community and was authored by Jagannath Ghantenavar
a = 'Dev.to'
a[::-1]
Explanation :
[start index : end index : step parameter ]
- The first colon : indicates the start index (default is the beginning of the sequence).
- The second colon : indicates the end index (default is the end of the sequence).
- The third colon : indicates the step parameter, which means the sequence should be traversed in steps of -1 (i.e., in reverse)..
This content originally appeared on DEV Community and was authored by Jagannath Ghantenavar
Jagannath Ghantenavar | Sciencx (2024-07-30T17:38:14+00:00) To Reverse a string with out using for loop in python. | DAY 1. Retrieved from https://www.scien.cx/2024/07/30/to-reverse-a-string-with-out-using-for-loop-in-python-day-1/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.