Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9786

Reverse String in Python Using Loop [closed]

$
0
0

I was reading this article to understand how can I reverse string in python.

Now while implementing I am getting stuck -

I couldn't use ".join(reversed(string)) or string[::-1] methods.

Here is what my code looks like:

def reverse(text):    while len(text) > 0:        print text[(len(text)) - 1],        del(text[(len(text)) - 1]

I am getting invalid syntax on del(text[(len(text)) - 1]

Is there any suggestion?

Thank you for your help!


Viewing all articles
Browse latest Browse all 9786

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>