I tried every thing I can think of but it skill turns out Oops, try again. Your function fails on reverse("coolstory"). It returns "yroootslc" when it should return "yrotslooc". please help

def reverse(text):
    list1 = list(text)
    list2 = list();
    while len(list1) > 0:
        n = len(list1)
        x = n - 1
    return "".join(list2)


remove removes based on matching items:

example = ['a','b','c']

use del to delete based on index (x contains indexes):

del example[0]


thanks that really helped me


issue resolved?


How about this?

def reverse (text):
    from string import join
    list = []
    for char in text:
       list.insert(0, char)
    return ''.join (list)


works fine, what is your question? You don't have to import join, it is imported by default


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.