To Reverse a string with out using for loop in python. | DAY 1

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)…


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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » To Reverse a string with out using for loop in python. | DAY 1." Jagannath Ghantenavar | Sciencx - Tuesday July 30, 2024, https://www.scien.cx/2024/07/30/to-reverse-a-string-with-out-using-for-loop-in-python-day-1/
HARVARD
Jagannath Ghantenavar | Sciencx Tuesday July 30, 2024 » To Reverse a string with out using for loop in python. | DAY 1., viewed ,<https://www.scien.cx/2024/07/30/to-reverse-a-string-with-out-using-for-loop-in-python-day-1/>
VANCOUVER
Jagannath Ghantenavar | Sciencx - » To Reverse a string with out using for loop in python. | DAY 1. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/30/to-reverse-a-string-with-out-using-for-loop-in-python-day-1/
CHICAGO
" » To Reverse a string with out using for loop in python. | DAY 1." Jagannath Ghantenavar | Sciencx - Accessed . https://www.scien.cx/2024/07/30/to-reverse-a-string-with-out-using-for-loop-in-python-day-1/
IEEE
" » To Reverse a string with out using for loop in python. | DAY 1." Jagannath Ghantenavar | Sciencx [Online]. Available: https://www.scien.cx/2024/07/30/to-reverse-a-string-with-out-using-for-loop-in-python-day-1/. [Accessed: ]
rf:citation
» To Reverse a string with out using for loop in python. | DAY 1 | Jagannath Ghantenavar | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.