About 76,500 results
Open links in new tab
  1. How do I reverse a string in Python? - Stack Overflow

    May 31, 2009 · Strings are sliceable. Slicing a string gives you a new string from one point in the string, backwards or forwards, to another point, by given increments. They take slice notation …

  2. python - printing a string backward - Stack Overflow

    Dec 27, 2015 · If you're passing it a string, then the nones are coming from someplace else. And as PM 2Ring suggested, make sure you aren't attempting to print the result of the function call, …

  3. python - Understanding string reversal via slicing - Stack Overflow

    The "-1" part represents the "step" part of the slicing—in this case, it goes through the string 1 character at a time, but backwards (a negative step means start from the end of the string). If …

  4. python - How to print a string backwards using a for loop - Stack …

    Oct 24, 2014 · I have to create a program that lets the user enter a string and then, using range, the program outputs that same string backwards. I entered this into python, but it goes me an …

  5. string - How to reverse words in Python - Stack Overflow

    Sep 18, 2013 · A string in Python is an array of chars, so you just have to traverse the array (string) backwards. You can easily do this like this: "Python is the best programming …

  6. How can I get Python to print an entered message backwards?

    Reverse a string in Python. Its been stumping me despite my initial thoughts that it would be simple. Originally, I thought I would have have it print the elements of the string backwards by …

  7. python - How can I print a single backslash? - Stack Overflow

    This is particularly tricky because it cannot be done with raw strings. For the related question about why such a string is represented with two backslashes, see Why do backslashes appear …

  8. python - How to continuously print input strings in reverse, but …

    Mar 5, 2022 · Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Done", …

  9. Python reversing a string using recursion - Stack Overflow

    That is, what is the trivial case you can solve without recursion? One answer is the one-character string, which is the same forward and reversed. So if you get a one-character string, you are …

  10. Best way to loop over a python string backwards

    Aug 9, 2015 · What is the best way to loop over a python string backwards? The following seems a little awkward for all the need of -1 offset: string = "trick or treat" for i in range(len(string)-1, 0 …

Refresh