Programming Languages
Python
Subjective
Sep 30, 2025
How do you reverse a string in Python? Show 3 different methods.
Detailed Explanation
1. Slicing: s[::-1]\n2. reversed(): "".join(reversed(s))\n3. Loop: result = ""; for char in s: result = char + result
Discussion (0)
No comments yet. Be the first to share your thoughts!
Share Your Thoughts