If you get an interview question to reverse a string without using any python built in method, try below
def reverse_text(text):
reversed_text = ""
length = len(text)
for i in range(length - 1, -1, -1):
reversed_text += text[i]
print(f"Reversed text: {reversed_text}")
# Example usage:
text = "hello welcome to the python world"
reverse_text(text)
Top comments (0)