Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (16.4k points)

Actually, there is no built-in function for reversing a Python's str object. What is the most ideal method of implementing this strategy? 

If you are Providing a succinct answer, kindly expand on its productivity. For instance, regardless of whether the str object is converted over to an alternate item, and so forth

1 Answer

0 votes
by (26.4k points)

Try the following code:

>>> 'hello world'[::-1]

'dlrow olleh'

That's extended slice syntax. It actually works by doing [begin:end:step] - by leaving start and end off and determining a stage of - 1, it reverses a string

Wanna become a expert in python? Come and join the python training course.

Watch the following video tutorial for more information and become expert in python

Related questions

0 votes
4 answers
0 votes
1 answer
asked Jul 18, 2019 in Java by Shubham (3.9k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...