def remove_extras(lst):
    counter = 0
    while counter < len(lst):
        for i in lst[counter + 1:]:
            if lst[counter] == i:
                lst.reverse()
                lst.remove(i)
                lst.reverse()
        counter = counter + 1
    return lst


def remove_extras(lst):
    new_list=[]
    for element in lst:
        if not is_same(element,new_list):
            new_list.append(element)
        else:
            continue
    return new_list

def is_same(test,lst):
    for e in lst:
        if e == test:
            return True
        else:
            continue
    return False

Task: Duplicate elimination

Write a function remove_extras(lst) that takes in a list and returns a new list with
all repeated occurrences of any element removed. For example, remove_extras([5,
2, 1, 2, 3]) returns the list [5, 2, 1, 3].


def remove_extras(lst):
    lst1 = []
    for i in lst:
        if i not in lst1:
            lst1.append(i)
    return lst1


def remove_extras(lst):
    new_lst = []
    for ele in lst:
        if ele in new_lst:
            continue
        else:
            new_lst += [ele]
    return new_lst


def remove_extras(lst):
    keep = []
    for i in lst :
        if i not in keep :
            keep.append(i)
    return keep


def remove_extras(lst):
    new = []
    x = 0
    for x in range(len(lst)):
        if lst[x] not in new:
            new += [lst[x]]
    return new


def remove_extras(lst):
    a = []
    for i in lst:
        if i not in a:
            a.append(i)
    return a


def remove_extras(lst):
    a=[]
    for i in lst:
        if i not in a:
            a.append(i)
    return a


def remove_extras(lst):
    output = []
    for i in lst:
        if i not in output:
            output.append(i)
    return output


def remove_extras(lst):
    if lst != []:

        my_list = []

        for i in range(len(lst)):
            if lst[i] not in my_list:
                my_list.append(lst[i])
        return my_list
    else:
        return []


def remove_extras(lst):
    # your code here
    l=[]
    for i in lst:
        if i not in l:
            l.append(i)
    return l


def remove_extras(lst):
    new = []
    for x in lst:
        if x not in new:
            new.append(x)
    return new


def remove_extras(lst):
    new_lst=[]
    for x in lst:
        if x in new_lst:
            continue
        else:
            new_lst+=[x,]
    return new_lst


def remove_extras(lst):
    lst.reverse()
    for i in lst:
        n=len(lst)
        counter = 1
        number_of_appearance = 0
        while counter <= n:
            if i == lst[counter-1]:
                counter += 1
                number_of_appearance += 1
            else:
                counter += 1
        while number_of_appearance != 1:
            lst.remove(i)
            number_of_appearance -= 1
    lst.reverse()
    return lst


def remove_extras(lst):
    a = []
    for i in lst:
        if i in a:
            continue
        else:
            a.append(i)
    return a


def remove_extras(lst):
    new = []
    for e in lst:
        if e not in new:
            new.append(e)
    return new


def remove_extras(lst):
	a = []
	for i in lst:
		if i not in a:
			a.append(i)
	return a


def remove_extras(lst):
    new_lst  = []
    for i in lst:
        if i not in new_lst:
            new_lst.append(i)
    return new_lst


def remove_extras(lst):
    dic = {}
    for e in lst:
        if e not in dic:
            dic[e] = 0
    return list(dic.keys())


def remove_extras(lst):
    t=[]
    for i in lst:
        if i not in t:
            t.append(i)
        else:
            pass
    return t


def remove_extras(lst):
    new_lst = []
    for i in lst:
        if i not in new_lst:
            new_lst.append(i)
        else:
            continue
    return new_lst


def remove_extras(lst):
    output = []
    for i in lst:
        if i in output:
            output.append(i)
    return output

# Lines, 4 is wrong


def remove_extras(lst):
    # your code here
    occurrences = ()
    new_lst = []
    for item in lst:
        if item not in occurrences:
            occurences += (item,)
            new_list.append(item)
    return new_lst

# Line 7 is wrong


def remove_extras(lst):
    # your code here
    occurrences = ()
    new_lst = []
    for item in lst:
        if item not in occurrences:
            occurrences += (item,)
            new_list.append(item)
    return new_lst

# Line 7 is wrong


def remove_extras(lst):
    length = len(lst)
    result = [lst[0]]
    for i in range(1,length):
        if lst[i] not in result:
            result = result + [lst[i]]
    return result

# Line 6 is wrong


def remove_extras(lst):
    new_list = []
    for number in list:
       if number not in new_list:
           new_list.append(number)
    return new_list

# Line 3 is wrong


def remove_extras(lst):
    lst1 = lst.reverse
    for i in lst:
        if lst.count(i) >1:
            lst1.remove(i) * (i-1)
    return lst1.reverse

# This is totally wrong


def remove_extras(lst):
    lst1 = lst.reverse
    for i in lst:
        if lst.count(i) >1:
            j = 0
            while j < i:
                lst1.remove(i)
                j += 1
    return lst1.reverse

# This is totally wrong


def remove_extras(lst):
    for i in range(lst):
        if lst[i] in lst[:i]+lst[i+1:]:
            lst.pop(i)
    return lst

# Completley wrong


def remove_extras(lst):
    for i in range(len(lst)):
        if lst[i] in lst[:i]+lst[i+1:]:
            lst.pop(i)
    return lst


def remove_extras(lst):
    for i in range(len(lst)-1):
        if lst[i] in lst[:i]+lst[i+1:]:
            lst.pop(i)
    return lst


def remove_extras(lst):
    result = []
    for i in lst and not result:
        result += result + i
    return result


def remove_extras(lst):
    result = []
    for i in lst:
        if i not in result:
            result += result + i
    return result


def remove_extras(lst):
    result = []
    for i in lst:
        if i not in result:
            result += result + list(i)
    return result


def remove_extras(lst):
    result = []
    for i in lst:
        if i not in result:
            result += result + [i]
    return result


def remove_extras(lst):
    lst.reverse()
    for i in lst:
        if lst.count(i) >1:
            j = 0
            while j < i:
                lst.remove(i)
                j += 1
    lst.reverse()
    return lst


def remove_extras(lst):
    for i in range(len(lst)):
        for j in range(j+1, len(lst)):
            if lst[j] == lst[i]:
                lst = lst[:j] + lst[j+1:]
    return lst


def remove_extras(lst):
    for i in range(len(lst)):
        for j in range(i+1, len(lst)):
            if lst[j] == lst[i]:
                lst = lst[:j] + lst[j+1:]
    return lst


def remove_extras(lst):
    i = 0
    while i < len(lst):
        for j in range(i+1,len(lst)):
            if lst[i] == lst[j]:
                lst = lst[:j] + lst[j+1:]
        i += 1
    return lst


def remove_extras(lst):
    i = 0
    while i < len(lst):
        j = i + 1
        while j < len(lst):
            if lst[i] == lst[j]:
                lst = lst[:j] + lst[j+1:]
            j += 1
    return lst


def remove_extras(lst):
    i = 0
    while i < len(lst):
        j = i + 1
        while j < len(lst):
            if lst[i] == lst[j]:
                lst = lst[:j] + lst[j+1:]
            j += 1
        i += 1
    return lst


def remove_extras(lst):
    new_lst = []
    for element in lst:
        if element not in new_lst:
            new_lst.append(element)
    return new_list


def remove_extras(lst):
    list1 = []
    for i in lst:
        if i not in list1:
            list1 += i
    return list1


def remove_extras(lst):
    return set(lst)


def remove_extras(lst):
    return list(set(lst))


def remove_extras(lst):
    result = []
    counter = 0
    while counter < len(lst):
        for i in lst[1:]:
            if lst[counter] == i:
                lst = lst.append(i)
    return lst


def remove_extras(lst):
    result = []
    counter = 0
    while counter < len(lst):
        for i in lst[1:]:
            if lst[counter] == i:
                lst = ((lst.reverse()).remove(i)).reverse()
        counter = counter + 1
    return lst


def remove_extras(lst):
    store = []
    for ele in lst:
        if ele not in store:
            store += ele
    return store


def remove_extras(lst):
    for i in lst:
        remove_mutiple(i, lst)
    return lst

def remove_multiple(n, lst):
    if lst.count(n) == 1:
        return lst
    else:
        lst.reverse()
        lst.remove(n)
        lst.reverse()
        return remove_multiple(n, lst)


def remove_extras(lst):
    for i in lst:
        if i not in sumx:
            sumx.append(i)
    return sumx


def remove_extras(lst):
    new_lst = []
    for ele in lst:
        if not (ele in new_lst):
            new_lst += ele
    return new_lst


def remove_extras(lst):
    new_lst = []
    for ele in lst:
        if not (ele in new_lst):
            new_lst.insert(len[new_lst]-1, ele)
    return new_lst


def remove_extras(lst):
    new_lst = []
    for ele in lst:
        if not (ele in new_lst):
            new_lst.insert(0, ele)
    return new_lst


def remove_extras(lst):
    output == []
    for entry in lst:
        if output.count[entry] == 0:
            output == output.append[entry]
    return output


def remove_extras(lst):
    output = []
    for entry in lst:
        if output.count[entry] == 0:
            output == output.append[entry]
    return output


def remove_extras(lst):
    new_lst=()
    for element in lst:
        if element not in new_lst:
            new_lst += (element,)
    return new_lst


def remove_extras(lst):
    s = []
    for i in lst:
       if i not in lst:
          s.append(i)
    return s
    # your code here
    pass


def remove_extras(lst):
    return list(set(lst))
    # your code here
    pass


def remove_extras(lst):
    new_lst = []
    for i in lst:
        if i == lst[i+1]:
            continue
        else:
            new_list += i
    return new_lst


def remove_extras(lst):
    a = []
    for i in lst:
        if i not in a:
            a += i
    return a


def remove_extras(lst):
    new = ()
    for x in lst:
        if lst.count(x) > 1:
            new += []
        else:
            new += [x,]
    return new
    pass


def remove_extras(lst):
    new = []
    for x in lst:
        if lst.count(x) > 1:
            new += []
        else:
            new = new.append(x)
    return new
    pass


def remove_extras(lst):
    new = []
    for x in lst:
        if lst.count(x) > 1:
            new += []
        else:
            new += [x,]
    return new
    pass


def remove_extras(lst):
    lst.sort()
    store = []
    for ele in lst:
        if ele not in store:
            store += [ele]
    return store


def remove_extras(lst):
    i = -1
    while i > (-len(lst)):
        if lst[i] in lst[:i]:
            del lst[i]
    i = i + 1
    return lst


def remove_extras(lst):
    return list(set(lst))


def remove_extras(lst):
    for num in lst:
        while lst.count(num)>1:
            lst.remove(num)
    return lst


def remove_extras(lst):
    new_lst = []
    for lst in new_lst:
        if i not in lst:
            new_lst += [i,]
    return new_lst
    pass


def remove_extras(lst):
    new_lst = []
    for new_lst in lst:
        if i not in lst:
            new_lst += [i,]
    return new_lst
    pass


def remove_extras(lst):
    new_lst = []
    for i in lst:
        if lst not in new_lst:
            new_lst += [i,]
    return new_lst
    pass


from collections import OrderedDict
def remove_extras(lst):
    return (OrderedDict.fromkeys(lst))


def remove_extras(lst):
    lst_final = []
    for i in lst:
        if i not in lst_final:
            lst_final = lst_final + i
    return lst_final


def remove_extras(lst):
    o = []
    for i in lst:
        if i not in o:
            o.append(lst.pop(i))
    return o


def remove_extras(lst):
    o = []
    for i in lst:
        if i not in o:
            o.append(lst.remove(i))
    return o


def remove_extras(lst):
    o = []
    for i in lst:
        if i not in o:
            lst.remove(i)
            o.append(i)
    return o


def remove_extras(lst):
    new_lst = lst[0]
    for e in lst:
        if e in new_lst:
            continue
        else:
            new_lst.append(e)

    return new_lst


def remove_extras(lst):
    new_lst = [lst[0],]
    for e in lst:
        if e in new_lst:
            continue
        else:
            new_lst.append(e)

    return new_lst


def remove_extras(lst):
    result =[]
    for element in lst:
        if element not in result:
            result.append[element]
    return result


def remove_extras(lst):
    extra = []
    for i in lst:
        if i not in lst:
            continue
        else:
            extra += i
    return lst.remove(int(extra))


def remove_extras(lst):
    remove_lst = []
    for i in lst:
        if i not in lst:
            remove_lst.append(i)
    return remove_lst


def remove_extras(lst):
    #find the repeated index
    n = len(lst)
    for i in range(n):
        for j in range(n):
            if lst[i] == lst[j] and i != j:
                a = lst[:j]+lst[n-j:]
            else:
                continue
    return a


def remove_extras(lst):
    newlst = []
    for i in lst:
        if i not in newlst:
            newlst = newlst.append(i)
    return newlst


def remove_extras(lst):
    return list(set(lst))


def remove_extras(lst):
    result = []
    for i in lst:
        if i not in result:
            result += i
    return result


def remove_extras(lst):
    lst.reverse()
    for element in lst:
        if lst.count(element)>1:
            lst.remove(element)
    return lst.reverse()


def remove_extras(list):
    list.reverse()
    for element in list:
        if list.count(element)>1:
            list.remove(element)
    return list.reverse()


def remove_extras(lst):
    newlst=[]
    for i in lst:
        if i not in newlst:
            newlst=newlst.append(i)
    return newlst
    # your code here
    pass


def remove_extras(lst):
    return list(set(lst))
    # your code here
    pass


def remove_extras(lst):
    for i in lst:
        result=lst.count(i)
        while result>1:
            lst.remove(i)
            result=result-1
    return lst


def remove_extras(lst):
    new_lst = []
    for x in lst:
        if x not in new_lst:
            new_lst += [x]
    return lst


def remove_extras(lst):
    newlst=[]
    for i in lst:
        if i not in newlst:
            newlst=newlst.append(i)
    return newlst

    # your code here
    pass


def remove_extras(lst):
    new_lst = [lst[0]]
    for i in range(0,len(lst)):
        a=lst[i]
        for h in range(i,len(lst)):
            if a!=lst[h]:
                ele=lst[h]
                new_lst.append(ele)
        return new_lst
    return new_lst


def remove_extras(lst):
    list = []
    for i in lst:
        if i not in list:
            list += lst[0]
    return lst


def remove_extras(lst):
    if lst == []:
        return []
    elif lst[0] not in lst[1:]:
        return lst[0] + remove_extras(lst[1:])
    else:
        return remove_extras(lst[1:])


def remove_extras(lst):
    if lst == []:
        return []
    elif lst[0] not in lst[1:]:
        return [lst[0],] + remove_extras(lst[1:])
    else:
        return remove_extras(lst[1:])


def remove_extras(lst):
    result = ()
    for i in lst:
        if i not in result:
            result = result + (i,)
        else:
            continue
    return result


def remove_extras(lst):
    a = ()
    n = len(lst)
    for i in range(n):
        for j in range(i,n):
            if lst[i] == lst[j] and i != j:
                a += (lst[j],)
            else:
                continue
    c = a[:-1]
    b = lst[::-1]
    for i in range(len(c)):
        b.remove(c[i])
    d = b[::-1]
    return d


def remove_extras(lst):
    sub_list = []
    for elem in lst:
        if elem not in lst[lst.index(elem)+1:]:
            return lst
        elif elem in lst[lst.index(elem)+1:]:
            sub_list += lst[lst.index(elem)+1:]
            sub_list.remove(elem)
            return lst[:lst.index(elem)] + sub_list


def remove_extras(lst):
    result=[]
    for i in lst:
        if i in lst[:i]:
            continue
        result+= [i]
    return result


def remove_extras(lst):
    result = []
    for item in lst:
        if item not in result:
            item += result
    return result


def remove_extras(lst):
    result = []
    for item in lst:
        if item not in result:
            result += item
    return result


def remove_extras(lst):
    sub_list = []
    for elem in lst:
        if elem not in lst[lst.index(elem)+1:]:
            return lst
        elif elem in lst[lst.index(elem)+1:]:
            sub_list += lst[lst.index(elem)+1:]
            while elem in sub_list:
                sub_list.remove(elem)
            return lst[:lst.index(elem)+1] + sub_list


def remove_extras(lst):
    new = []
    for i in lst:
        if i not in new:
            new += i
        else:
            continue
    return new


def remove_extras(values):
    output = []
    for value in values:
        if value not in seen:
            output.append(value)
    return output


def remove_extras(lst):
    result = []
    for i in lst:
        if i not in result:
            result = result + i
    return result

    # your code here
    pass


def remove_extras(lst):
    copy = lst.copy()
    for i in copy:
        if copy.count(i) > 1:
            left = lst[:copy.index(i)+1]
            right = lst[copy.index(i)+1:]
            right.remove(i)
            copy = left + right
    return copy


def remove_extras(lst):
    for element in lst:
        if element in lst.remove(element):
            lst = lst.remove(element)
        else:
            lst
        return lst

    pass


def remove_extras(lst):
    # your code here
    for item in st:
        while lst.count(item) != 1:
            lst.pop(item)
    return lst


def remove_extras(lst):
    # your code here
    lst.reverse()
    for item in lst:
        while lst.count(item) != 1:
            lst.remove(item)
            print(lst)
    return lst


def remove_extras(lst):
    # your code here
    lst.reverse()
    for item in lst:
        while lst.count(item) != 1:
            lst.remove(item)

    return lst


def remove_extras(lst):
    # your code here
    lst.reverse()
    for item in lst:
        while lst.count(item) != 1:
            lst.remove(item)
    lst.reverse

    return lst


def remove_extras(lst):
    a = []
    for i in lst:
        if i not in a:
            a.append(i)
    return i


def remove_extras(lst):
    a = []
    for i in lst:
        if i not in a:
            a.append(i)
        return i


def remove_extras(lst):
    for k in range(len(lst)):
        if lst[k] in lst[:k]:
            return lst.remove(lst[k])
        else:
            return lst


def remove_extras(lst):
    # your code here
    result = (lst[0],)
    count = 0
    for item in lst[1:]:
        if item == result[count]:
            count += 1
        else:
            result +=(item,)
            count +=1
    return result


def remove_extras(lst):
    # your code here
    result = (lst[0],)
    for item in lst[1:]:
        if item in result:
            continue
        else:
            result +=(item,)
    return result


def remove_extras(lst):
    # your code here
    result = (lst[0],)
    for item in lst[1:]:
        if item in result:
            continue
        else:
            result +=(item,)
    return list(result)


def remove_extras(lst):
    for k in range(len(lst)):
        if lst[k] in lst[:k]:
            return lst[:k] + lst[k+1:]
        else:
            return lst


def remove_extras(lst):
    for i in lst:
        if lst.count(i)>1:
            lst=lst.reverse()
            lst=lst.remove(i)
            lst=lst.reverse
    return lst


def remove_extras(lst):
    final=[]
    for x in lst:
        if x !=final:
            final.append(x)
    return final
    pass


def remove_extras(lst):
    answer = []
    for i in lst:
        for a in answer:
            if i == a:
                break
        answer += i
    return answer


def remove_extras(lst):
    compare = lst[0]
    for element in lst[1:]:
        if element == compare:
            lst.remove(element)
    print(lst)


def remove_extras(lst):
    # your code here
    new_lst = []
    for i in lst:
        if i not in lst:
            new_lst += [i,]
    return new_lst


def remove_extras(lst):
    # your code here
    return list(set(lst))


def remove_extras(lst):
    result=[]
    for i in lst:
        if i not in result:
            result=result+i
    return result


def remove_extras(lst):
    newlist = []
    for i in lst:
        if i in newlist:
            continue
        else:
            newlist += i
    return newlist


def remove_extras(lst):
    new_lst = []
    for ele in lst:
        if ele not in new_list:
            new_lst += ele
    return new_lst


def remove_extras(lst):
    new_lst = []
    for ele in lst:
        if ele not in new_lst:
            new_lst += ele
    return new_lst


def remove_extras(lst):
    seq = (lst[0],)
    for i in lst:
        if i not in seq:
            seq = seq + (lst[i],)
    return seq
    pass


def remove_extras(lst):
    seq = (lst[0],)
    for i in lst:
        if i not in seq:
            seq = seq + (i,)
    return seq


def remove_extras(lst):
	seq = (lst[0],)
	for i in lst:
		if i not in seq:
			seq = seq + (i,)
	return seq


def remove_extras(lst):
    seq = [lst[0],]
    for i in lst:
        if i not in seq:
            seq = seq + [i,]
    return seq


def remove_extras(lst):
    i = -1
    while i > (-len(lst)):
        if lst[i] in lst[:i]:
            lst.pop[i]
    i = i + 1
    return lst


def remove_extras(lst):
    i = -1
    while i < (-len(lst)):
        if lst[i] in lst[:i]:
            lst.pop[i]
    i = i - 1
    return lst


def remove_extras(lst):
    i = -1
    while i < (-len(lst)):
        if lst[i] in lst[:i]:
            lst.pop(i)
    i = i - 1
    return lst


def remove_extras(lst):
    i = -1
    while i > (-len(lst)):
        if lst[i] in lst[:i]:
            lst.pop(i)
    i = i - 1
    return lst


def remove_extras(lst):
    i = -1
    while i >= (-len(lst)):
        if lst[i] in lst[:i]:
            lst.pop(i)
    i = i - 1
    return lst


def remove_extras(lst):
    i = -1
    while i >= (-len(lst)):
        if lst[i] in lst[:-1]:
            lst.pop(i)
    i = i - 1
    return lst


def remove_extras(lst):
    new_list = []
    for item in list:
        if new_list.count(item) == 0:
            new_list.append(item)
    return new_list


def remove_extras(lst):
    lst.reverse()
    if lst[0] in lst[1:]:
        lst.pop(0)
    lst.reverse()
    return lst


def remove_extras(lst):
    lst1 = []
    for i in range(len(lst)):
        if lst[i] in lst1:
            lst1.remove(lst[i])
            return lst1
        else:
            return []


def remove_extras(lst):
    lst1 = []
    for i in range(len(lst)):
        if lst[i] in lst1:
            lst1.remove(lst[i])
            return lst1
        else:
            return lst


def remove_extras(lst):
    my_lst = []
    for i in lst:
        if i not in my_lst:
            my_lst.append(i)
        return my_lst


def remove_extras(lst):
    result = []
    for i in range(len(lst)):
        if lst[i] not in result:
            result += lst[i]
            continue
    return result


def remove_extras(lst):
    for i in range (0, len(lst)):
        for j in range (i + 1, len(lst)):
            if lst[j] == lst[i]:
                lst.pop(j)
                print (lst)
            else:
                continue
            return remove_extras(lst)


def remove_extras(lst):
    for i in range (0, len(lst)):
        for j in range (i + 1, len(lst)):
            if lst[j] == lst[i]:
                lst.pop(j)
                return remove_extras(lst)


def remove_extras(lst):
    new_lst = []
    for i in lst:
        new_lst += new_lst.append(i)
        if new_lst.count(i) > 1:
            new_lst.pop
    return new_lst


def remove_extras(lst):
    new_lst = []
    for i in lst:
        new_lst.append(i)
        if new_lst.count(i) > 1:
            new_lst.pop
    return new_lst


def remove_extras(lst):
    new_lst = []
    for i in lst:
        new_lst.append(i)
        if new_lst.count(i) > 1:
            new_lst.pop
            continue
    return new_lst


def remove_extras(lst):
    for i in lst:
        if lst.count(i)>1:
            lst.remove(i)
    return lst


def remove_extras(lst):
    lst2=[]
    for i in lst:
        if i not in lst2:
            lst2+=i
    return lst2


def remove_extras(lst):
    result = []
    for i in lst:
        if i not in result:
            result.append[i]
    return result
    pass


def remove_extras(lst):
    for i in range(1,len(lst)):
        if i in lst[i:]:
            lst = lst.remove(i)
    return lst


def remove_extras(lst):
    result = []
    for ele in lst:
        if x not in result:
            result += x
    return result


def remove_extras(lst):
    result = []
    for ele in lst:
        if x not in result:
            result += x
        return result


def remove_extras(lst):
    result = []
    for ele in lst:
        if ele not in result:
            result += ele
    return result


def remove_extras(lst):
    result = []
    for ele in lst:
        if ele not in result:
            result += ele
        return result


def remove_extras(lst):
    new = []
    for i in lst:
        if i not in new:
            new += i
        else:
            continue
    return new


def remove_extras(lst):
    for i in lst:
        test_lst = lst.remove(i)
        if i not in test_lst:
            continue
        else:
            lst = lst.remove(i)
    return lst


def remove_extras(lst):
    new_lst = lst
    for i in lst:
        n = new_lst.count(i)
        while True:
            if n <= 1:
                break
            else:
                new_lst.remove(i)
                n -= 1
    return new_lst


def remove_extras(lst):
    newlist = []
    for i in lst:
        if i not in newlist:
            newlist.append(i)


def remove_extras(lst):
    pst=[]
    for i in lst:
        if i not in pst:
            pst.extend(i)
    return pst


def remove_extras(lst):
    pst=[]
    for i in lst:
        if i not in pst:
            pst.extend(list(i))
    return pst


def remove_extras(lst):
    newlst = []
    for i in lst:
        if i not in lst:
            newlst.append(i)
    return newlst


def remove_extras(lst):
    new_lst = []
    for i in lst:
        if i not in new_lst:
            new_lst += i
    return new_lst


def remove_extras(lst):
    new = []
    for i in lst:
        if i not in new:
            new += i
    return new


def remove_extras(lst):
    i = 0
    while i < len(lst):
        if lst[0] in lst[1:]:
            lst.remove(lst[0])
        i = i + 1
    return lst


def remove_extras(lst):
    return set(lst)


def remove_extras(lst):
    newlst = lst(0)
    for i in lst:
        if i not in newlst:
            newlst += [i]
    return newlst


def remove_extras(lst):
    a = []
    for repeat in range(len(lst) + 1):
        if repeat != a:
            a += repeat
    return a


def remove_extras(lst):
    a = []
    for repeat in range(len(lst) + 1):
        if repeat not in a:
            a += repeat
    return a


def remove_extras(lst):
    a = []
    for repeat in range(len(lst) + 1):
        if repeat not in a:
            a += [repeat,]
    return a


def remove_extras(lst):
    one = [lst[0],]
    for repeat in lst:
        if repeat not in one:
            one += [repeat,]
    return one


def remove_extras(lst):
    for i in range(len(lst)):
        for j in range(len(lst[1:])):
            if lst[i] == lst[j]:
                del lst[j]
    return lst


def remove_extras(lst):
    for i in range(len(lst)-1):
        for j in range(i+1,len(lst[1:])):
            if lst[i] == lst[j]:
                del lst[j]
    return lst


def remove_extras(lst):
    for i in range(len(lst)):
        print(lst[i:])
        print(lst[i:].count(lst[i]))
        if lst.count(lst[i]) > 1:
            element = lst[i]
            lst.reverse()
            lst.remove(element)
            lst.reverse()
    return lst


def remove_extras(lst):
    for i in range(len(lst)):
        if lst[i] in lst[i+1:]:
            lst.pop(i)
    return lst


def remove_extras(lst):
    for i in range(len(lst)-1):
        if lst[i] in lst[i+1:]:
            lst.pop(i)
    return lst


def remove_extras(lst):
    # your code here
    n = 0
    while n < len(lst):
        lst = lst[n] + lst[n+1:].remove(lst[n])
        n = n + 1
    pass


def remove_extras(lst):
    # your code here
    n = 0
    while n < len(lst):
        lst = lst[n] + lst[n+1:].remove(lst[n])
        n = n + 1
    return lst
    pass


def remove_extras(lst):
    # your code here
    n = 0
    while n < len(lst):
        if lst[n] in lst[n+1:]:
            lst = lst[:n+1] + lst[n+1:].remove(lst[n])
        n = n + 1
    return lst


def remove_extras(lst):
    lst.sort()
    i=0
    while i<len(lst):
        if i==len(lst)-1:
            break
        elif lst[i]==lst[i+1]:
            lst.remove(lst[i])
        else:
            i+=1
    return lst


def remove_extras(lst):
    a =[lst[0]]
    i = lst[0]
    for j in range (1,len(lst)): #while lst is not empty
        if i == lst[j]:
            continue
        else:
            a += [lst[j]]

    return a


def remove_extras(lst):
    removed = []
    for e in lst:
       if e not in lst:
          removed.append(e)
    return removed


def remove_extras(lst):
    removed = []
    for e in lst:
       if e not in lst:
          removed = removed.append(e)
    return removed


def remove_extras(lst):
    removed = []
    for e in lst:
       if (e in lst) and (e not in removed):
          removed = removed.append(e)
    return removed


def remove_extras(lst):
    new_list = []
    for elem in lst:
        if elem not in new:
            new.append(elem)
        else:
            new_list
    return new_list
    pass


def remove_extras(lst):
    new_list = []
    for elem in lst:
        if elem not in new:
            new_list += new.append(elem)
        else:
            new_list
    return new_list


def remove_extras(lst):
    new_list = []
    for elem in lst:
        if elem not in new:
            new_list += new.append(elem)
    return new_list


def remove_extras(lst):
    for i in lst:
        lst.remove(i)
        lst.remove(i)
        return lst


def remove_extras(lst):
    for i in range (len(lst)-1):
        for j in lst[i+1:]:
            if j==lst[i]:
                lst.remove(j)
    return lst


def remove_extras(lst):
    check=True
    lst1=[]
    for i in lst:
        for j in lst1:
            if j==i:
                check=False
        if check:
            lst1+=[i,]
    return lst1


def remove_extras(lst):
    count=0
    rev_lst=lst.reverse()
    ori_len=len(lst)
    for i in range(ori_len):
        if rev_lst[i] in rev_lst[i+1:]:
            lst.pop(ori_len-i-1)
    return lst


def remove_extras(lst):
    count=0
    rev_lst=lst.reverse()
    ori_len=len(lst)
    new_lst=lst.copy()
    for i in range(ori_len):
        if rev_lst[i] in rev_lst[i+1:]:
            new_lst.pop(ori_len-i-1)
    return new_lst


def remove_extras(lst):
    new_list = []
    for item in lst:
        if item not in new_list:
            new_list.append.item
    return new_list


def remove_extras(lst):
    n = len(lst)
    for counter1 in range(n):
        for counter2 in range(n):
            if lst[counter1] == lst[counter2]:
                lst = lst[:counter1] + lst[counter1 + 1:]
    return lst


def remove_extras(lst):
    new_lst = []
    for i in lst:
        if i not in new_lst:
            new_lst = new_lst + i
        else:
            continue
    return new_lst


def remove_extras(lst):
    return list(set(lst))


def remove_extras(lst):
    new = []
    for x in lst:
        if x not in new:
            new += x
    return new


def remove_extras(lst):
    new_lst=[lst[0]]
    if lst==[]:
        return []
    for i in range(len(lst)):
        a=lst[i]
        for h in range(i,len(lst)):
            if a!=lst[h]:
                ele=lst[h]
                if ele in new_lst:
                    continue
                new_lst.append[ele]
    return new_list


def remove_extras(lst):
    new_lst=[lst[0]]
    if lst==[]:
        return []
    for i in range(len(lst)):
        a=lst[i]
        for h in range(i,len(lst)):
            if a!=lst[h]:
                ele=lst[h]
                if ele in new_lst:
                    continue
                new_lst.append(ele)
    return new_list


def remove_extras(lst):
    lst1 = []
    for item in lst:
        if (item in lst1):
            continue
        else:
            lst1 += item
    return lst1


def remove_extras(lst):
    new_lst=[lst[0]]
    if lst==[]:
        return []
    for i in range(len(lst)):
        a=lst[i]
        for h in range(i,len(lst)):
            if a!=lst[h]:
                ele=lst[h]
                if ele in new_lst:
                    continue
                new_lst.append(ele)
    return new_lst


def remove_extras(lst):
    for elem in lst:
        while elem in lst[lst.index(elem)+1:]:
            lst.remove(elem)
    return lst


def remove_extras(lst):
    lst.sort()
    i = 0
    while i <len(lst)-1:
        if lst[i+1] == lst[i]:
            lst.remove(lst[i])
        else:
            i += 1
    return lst


def remove_extras(lst):
    for i in lst:
        for j in lst[0:i]:
            if i == j:
                remove.lst(lst[i])
            else:
                continue
    return lst
    pass


def remove_extras(lst):
    lst.sort()
    result = []
    for i in lst:
        if i not in result:
            result = result + [i]
    return result


def remove_extras(lst):
    lst.sort()
    i = 1
    n = len(lst)
    while i < n:
        if lst[i]==lst[i-1]:
            lst.remove(i)
        else:
            i += 1
        n = len(lst)
    return lst
    pass


def remove_extras(lst):
    lst.sort()
    i = 1
    n = len(lst)
    while i < n:
        if lst[i]==lst[i-1]:
            lst.remove(lst[i])
        else:
            i += 1
        n = len(lst)
    return lst
    pass


def remove_extras(lst):
    lst.sort()
    i = 1
    n = len(lst)
    while i < n:
        if lst[i]==lst[i-1]:
            lst.pop(i)
        else:
            i += 1
        n = len(lst)
    return lst
    pass


def remove_extras(lst):
    new_list = []
    for elem in lst:
        if elem not in new_list:
            new_list += new.append(elem)
    return new_list


def remove_extras(lst):
    for element in lst:
        for count in lst:
            if count +2 > len(lst):
                return lst
            elif lst[count+1] == element:
                lst.remove(element)
                continue
            return lst


def remove_extras(lst):

    def position(i):
        n = len(lst)
        for j in range(n):
            if lst[j] == i:
                return j
    def helper(start,i):
        for k in lst[start:]:
            if k == i:
                lst.remove(k)
        else:
            pass

    for i in lst:
        index = position(i)
        helper(index+1,i)
    return lst


def remove_extras(lst):
    new_list = []
    for element in lst:
        if element in new_list:
            continue
        else:
            new_list += new_list.append(element)


def remove_extras(lst):
    i=0
    while i<len(lst):
        curr = lst[i]
        new = []
        for ele in lst:
            if ele == curr:
                continue
            new += [ele,]
        lst = new.copy
        i +=1


def remove_extras(lst):
    i=0
    while i<len(lst):
        curr = lst[i]
        new = []
        for ele in lst:
            if ele == curr:
                continue
            new += [ele,]
        lst = new.copy
        i +=1
    return lst


def remove_extras(lst):
    i=0
    new = []
    while i<len(lst):
        curr = lst[i]
        for ele in lst:
            if ele == curr:
                continue
            new += [ele,]
        lst = new.copy
        new = []
        i +=1
    return lst


def remove_extras(lst):
    i=0
    new = []
    while i<=len(lst):
        curr = lst[i]
        for ele in lst:
            if ele == curr:
                continue
            new += [ele,]
        lst = new.copy
        new = []
        i +=1
    return lst


def remove_extras(lst):
    i=0
    new = []
    while i<=len(lst):
        curr = lst[i]
        for ele in lst:
            if ele == curr:
                continue
            new += [ele,]
        lst = new.copy()
        new = []
        i +=1
    return lst


def remove_extras(lst):
    for i in lst:
        if lst.count(i) > 1:
            lst.pop(i)
    return lst


def remove_extras(lst):
    for i in lst:
        if lst.count(i) > 1:
            lst.remove(i)
    return lst


def remove_extras(lst):
    for i in range(len(lst)-1):
        if lst.count(lst[i]) > 1:
            lst.pop(i)
    return lst


def remove_extras(lst):
    new_lst = []
    for i in list:
        if i not in lst[i:]:
            new_lst = lst.append(i)
    return new_lst

    pass


def remove_extras(lst):
    new_lst = []
    for i in list:
        if i not in lst[i:]:
            new_lst = new_lst.append(i)
    return new_lst

    pass


def remove_extras(lst):
    for i in range(0, len(lst)-1):
        if lst.count(lst[i]) > 1:
            lst.pop(i)
    return lst


def remove_extras(lst):
    for i in range(0, len(lst)-1):
        num = lst[i]
        if lst.count(num) > 1:
            lst.pop(i)
    return lst


def remove_extras(lst):
    for i in range(0, len(lst)-2):
        num = lst[i]
        if lst.count(num) > 1:
            lst.pop(i)
    return lst


def remove_extras(lst):
    for i in lst:
        if lst.count(i) > 1:
            lst.reverse.remove(i).reverse
    return lst


def remove_extras(lst):
    for i in lst:
        if lst.count(i) > 1:
            ((lst.reverse()).remove(i)).reverse
    return lst


def remove_extras(lst):
    new_lst = []
    for i in lst:
        if i not in lst[i:]:
            new_lst = new_lst.append(i)
    return new_lst

    pass


def remove_extras(lst):
    lst = []
    for i in lst:
        if lst.count(i) == 1:
            lst += i

    return lst


def remove_extras(lst):
    new_lst = []
    for i in lst:
        if lst.count(i) == 1:
            lst.append(i)
    return neW_lst


def remove_extras(lst):
    new_lst = []
    for i in lst:
        if lst.count(i) == 1:
            lst.append(i)
    return new_lst


def remove_extras(lst):
    new_lst = []
    for i in lst:
        if lst.count(i) == 1:
            new_lst.append(i)
    return new_lst


def remove_extras(lst):
    newseq = []
    for element in lst:
        if element not in newseq:
            newseq += [n]
    return newseq


def remove_extras(lst):
    l=len(lst)
    for i in l:
        for j in range(i+1,l):
            if lst[i]==lst[j]:
                del lst[j]
    return lst

    # your code here
    pass


def remove_extras(lst):
    l=len(lst)
    for i in l:
        for j in range(i+1,l):
            if lst[i]==lst[j]:
                del lst[j]
    return lst


def remove_extras(lst):
    l=len(lst)
    for i in range(l):
        for j in range(i+1,l):
            if lst[i]==lst[j]:
                del lst[j]
    return lst


def remove_extras(lst):
    l=len(lst)
    for i in range(l-1):
        for j in range(i+1,l):
            if lst[i]==lst[j]:
                del lst[j]
    return lst


def remove_extras(mylist):
    for i in mylist:
        if i not in newlist:
            newlist.append(i)
    return newlist


def remove_extras(lst):
    new_lst = []
    if lst == []:
        return new_lst
    elif lst[0] not in lst:
        new_lst += lst[0] + remove_extras(lst[1:])
    else:
        new_lst += remove_extras(lst[1:])


def remove_extras(lst):
    new_list=[lst[0]]
    for i in lst:
        if i in new_list == True:
            continue
        else:
            new_list.append(i)
    return new_list


def remove_extras(lst):
    new_list=[list[0]]
    for i in lst:
        if i in new_list:
            continue
        else:
            new_list.append(i)
    return new_list


def remove_extras(lst):
    new_list=[lst[0]]
    for i in lst:
        if i in new_list:
            continue
        else:
            new_list.append(i)
    return new_list


def remove_extras(lst):
    i=1
    while True:
        if lst[i] in lst[:i]:
            del lst[i]
            continue

        if lst[i]==lst[-1]:
            break
        i=i+1
    return lst


def remove_extras(lst):
    i=1
    while i!=len(lst):
        if lst[i] in lst[:i]:
            del lst[i]
            continue
        i+=1
    return lst


def remove_extras(lst):
    new_lst = []
    for i in range(len(lst)):
        if lst[i] != new_lst:
            new_lst += lst[i]
    return new_lst

        # your code here
    pass


def remove_extras(lst):
    newLst=[]
    hashtable=[]
    for i in lst:
        if hashtable[lst[i]]!=1:
            hasttable[lst[i]]=1
            newLst.append(lst[i])

    return newLst


def remove_extras(lst):
    new_list = []
    for number in list:
       if number not in new_list:
           new_list.append(number)
    return new_list


def remove_extras(lst):
    newlist = []
    for element in lst:
        if newlist.count(element)==0:
            newlist += element
    return newlist
    pass


def remove_extras(lst):

    result = lst
    for i in result:

        if lst.count(i) > 1:
            result.remove(i)
            continue

    return result
    pass


def remove_extras(lst):
    new = []
    for ele in lst:
        if ele not in lst:
            new = new + [ele,]
    return new# your code here


def remove_extras(lst):
    # your code here
    new_list = []
    for i in lst:
        if i not in new_list:
            new_list = new_list + i
    return new_list


def remove_extras(lst):
    new_lst = []
    if lst == []:
        return new_lst
    elif lst[0] in new_lst:
        return new_lst + remove_extras(lst[1:])
    else:
        new_lst += [lst[0]]
        return new_lst + remove_extras(lst[1:])


from collections import OrderedDict

def remove_extras(lst):
    return lists(OrderedDict.fromkeys(lst))


def remove_extras(lst):
    new_list = []
    for elem in lst:
        if elem not in new_list:
            new_list += new_list.append(elem)
    return new_list


def remove_extras(lst):
    new_list = []
    for elem in lst:
        if elem not in new_list:
            new_list = new_list.append(elem)
    return new_list


def remove_extras(lst):
    lst.sort()
    i = len(lst)-1
    while i > 0:
        if lst[i] == lst[i - 1]:
            lst.pop(i)
        i=i-1
    return lst


def remove_extras(lst):
    for element in lst:
        if count(element) > 1:
            lst.remove(element)
    return lst


def remove_extras(lst):
    for element in lst:
        if lst.count(element) > 1:
            lst.remove(element)
    return lst


def remove_extras(lst):
    lst.sort()
    i = len(lst)-1
    while i > 0:
        if lst[i]==lst[i - 1]:
            lst.pop(i)
        i-=1
    return lst


def remove_extras(lst):
    return list(set(lst))


def remove_extras(lst):
    listt = lst.reverse()
    for element in listt:
        if listt.count(element) > 1:
            listt.remove(element)
    return listt.reverse()


def remove_extras(lst):
    listt = lst.copy()
    listtt = listt.reverse()
    for element in listtt:
        if listtt.count(element) > 1:
            listtt.remove(element)
    return listtt.reverse()


def remove_extras(lst):
    lst = list(seq)
    if len(lst) >= abs(index):
        del lst[index]
        return tuple(lst)
    else:
        return seq


def remove_extras(lst):
    return list(OrderedDict.fromkeys(lst))


def remove_extras(lst):
    newlist = []
    for i in list:
        if i not in list:
            newlist += i,
    return newlist


def remove_extras(lst):
    s = []
    for i in lst:
        if i not in s:
            s.append(i)


def remove_extras(lst):
    result = lst[0]
    for e in lst:
        if e not in result:
            result += (e,)
    return result


def remove_extras(lst):
    result = lst[0]
    for e in lst:
        if e not in result:
            result += (e,)
        else:
            continue
    return result


def remove_extras(lst):
    result = lst[0]
    for e in lst:
        if e not in result:
            result.add(e)
        else:
            continue
    return result


def remove_extras(lst):
    result = lst[0]
    for e in lst:
        if e not in result:
            result.append(e)
        else:
            continue
    return result


def remove_extras(lst):
    result = [lst[0],]
    for e in lst:
        if e not in result:
            result.append(e)
        else:
            continue
    return result


def remove_extras(lst):
    if lst == []:
        return None
    else:
        result = [lst[0],]
        for e in lst:
            if e not in result:
                result.append(e)
            else:
                continue
        return result


def remove_extras(lst):
    new_list = ()
    for x in lst:
        if x not in new_list:
            new_list += (x)
    return new_list


def remove_extras(lst):
    new_list = ()
    for x in lst:
        if x not in new_list:
            new_list.append(x)
    return new_list


def remove_extras(lst):
    new_list = ()
    for x in lst:
        if x not in new_list:
            new_list += ((x))
    return new_list


def remove_extras(lst):
    new_list = ()
    for x in lst:
        if x not in new_list:
            new_list += x
    return new_list


def remove_extras(lst):
    return set(lst)


def remove_extras(lst):
    for x in range(len(lst)):
        if lst[x] in lst[:x] or lst[x] in ls[x+1:]:
            lst.remove(lst[x])
    return lst


def remove_extras(lst):
    lst2 = []
    for x in lst:
        if lst.count(x) < 1:
            lst2.append(x)
    return lst2


def remove_extras(lst):
    for element in lst:
        while lst.count(element) > 1:
            lst.remove(element)
            if  lst.count(element) == 1:
                break
        return lst


def remove_extras(lst):
    new = []
    for i in lst:
        for j in i:
            if j != i:
                new.append(j)
    return new


def remove_extras(lst):
    new_list=[]
    for i in range(len(lst)):
        judge=0
        for j in range(i):
            if lst[i]==lst[j]:
                judge=1
        if judge==0:
            new_list+=[lst[i],]
    return new_lst
    # your code here
    pass


def remove_extras(lst):
    new_list=[]
    for e in lst:
        if not is_same(element,new_list):
            new_list.append(element)
        else:
            continue
    return new_list

def is_same(test,lst):
    for e in lst:
        if e == test:
            return True
        else:
            continue
    return False


def remove_extras(lst):
    lst1 = []
    for i in lst:
        if i not in newlist:
            lst1.append(i)
    return lst1


def remove_extras(lst):
    keep = []
    remove = []
    for i in lst :
        if i not in keep :
            keep.append(i)
        else :
            remove.append(i)
    for i in remove :
        lst.remove(i)
    return lst

    pass


def remove_extras(lst):
    keep = []
    remove = []
    for i in lst :
        if i not in keep :
            keep.append(i)
        elif i in keep :
            remove.append(i)
    for i in remove :
        lst.remove(i)
    return lst

    pass


def remove_extras(lst):
    keep = []
    destroy = []
    for i in lst :
        if i not in keep :
            keep.append(i)
        elif i in keep :
            destroy.append(i)
    for i in destroy :
        lst.remove(i)
    return lst


def remove_extras(lst):
    keep = []
    for i in lst :
        if i not in keep :
            keep.append(i)
    return lst


def remove_extras(lst):
    new = []
    x = 0
    while x < len(lst)+1:
        if lst[x] in new:
            new += lst[x]
        else:
            continue
    return new


def remove_extras(lst):
    new = []
    x = 0
    while x < len(lst)+1:
        if lst[x] in new:
            new += [lst[x]]
        else:
            continue
    return new


def remove_extras(lst):
    new = []
    x = 0
    for x in range(len(lst)):
        if lst[x] in new:
            new += [lst[x]]
        else:
            continue
        return new


def remove_extras(lst):
    a=[]
    for i in lst:
        if i not in a:
            a+=i
    return a


def remove_extras(lst):
    new = []
    for x in lst:
        if x not in new:
            new.append(x)
    return x


def remove_extras(lst):
    n=len(lst)
    for i in lst:
        counter = 1
        number_of_appearance = 0
        while counter <= n:
            if i == lst[counter-1]:
                counter += 1
                number_of_appearance += 1
            else:
                counter += 1
        while number_of_appearance != 1:
            lst.remove(i)
            number_of_appearance -= 1
    return lst


def remove_extras(lst):
    return list(set(lst))


def remove_extras(lst):
    a = []
    for i in lst:
        if i in a:
            continue
        a.extend(i)
    return a


def remove_extras(lst):
    a = []
    for i in lst:
        if i in a:
            continue
        else:
            a.extend(i)
    return a


def remove_extras(lst):
    new_lst  = []
    for i in lst:
        if i not in new_lst:
            new_list.append(i)
    return new_lst


def remove_extras(lst):
    t=[]
    for i in lst:
        if i not in t:
            t.append(i)


def remove_extras(lst):
    t=[]
    for i in lst:
        if i not in t:
            t.append(i)
        else:
            return t


def remove_extras(lst):
    result = []
    for i in lst and not result:
        result += result + i
    return result


def remove_extras(lst):
    i = 0
    while i < len(lst):
        j = i + 1
        while j < len(lst):
            if lst[i] == lst[j]:
                lst = lst[:j] + lst[j+1:]
            j += 1
    return lst


def remove_extras(lst):
    i = 0
    while i < len(lst):
        j = i + 1
        while j < len(lst):
            if lst[i] == lst[j]:
                lst = lst[:j] + lst[j+1:]
            j += 1
        i += 1
    return lst


def remove_extras(lst):
    for i in lst:
        remove_mutiple(i, lst)
    return lst

def remove_multiple(n, lst):
    if lst.count(n) == 1:
        return lst
    else:
        lst.reverse()
        lst.remove(n)
        lst.reverse()
        return remove_multiple(n, lst)


def remove_extras(lst):
    for i in lst:
        lst.remove(i)
        lst.remove(i)
        return lst


def remove_extras(lst):
    count=0
    rev_lst=lst.reverse()
    ori_len=len(lst)
    for i in range(ori_len):
        if rev_lst[i] in rev_lst[i+1:]:
            lst.pop(ori_len-i-1)
    return lst


def remove_extras(lst):
    i=1
    while True:
        if lst[i] in lst[:i]:
            del lst[i]
            continue

        if lst[i]==lst[-1]:
            break
        i=i+1
    return lst


def remove_extras(lst):
    new_list=[]
    for e in lst:
        if not is_same(element,new_list):
            new_list.append(element)
        else:
            continue
    return new_list

def is_same(test,lst):
    for e in lst:
        if e == test:
            return True
        else:
            continue
    return False


def sort_age(lst):
    for i in range(0, len(lst)-1):
        for j in range(i+1, len(lst)):
            if lst[i][1] < lst[j][1]:
                tmp = lst[i]
                lst[i] = lst[j]
                lst[j] = tmp
    return lst

Task: Sorting Tuples

Can we sort items other than integers? For this question, you will be sorting tuples!
We represent a person using a tuple (<gender>, <age>). Given a list of people, write
a function sort_age that sorts the people and return a list in an order such that the older
people are at the front of the list. An example of the list of people is [("M", 23), ("F",
19), ("M", 30)]. The sorted list would look like [("M", 30), ("M", 23), ("F", 19)]. You
may assume that no two members in the list of people are of the same age.


def sort_age(lst):
    output = []
    for i in range(len(lst)):
        largest = max(lst, key=lambda p: p[1])
        lst.remove(largest)
        output.append(largest)
    return output


def sort_age(lst):
    new = []
    while lst:
        largest = lst[0][1]
        for i in lst:
            if i[1] > largest:
                largest = i[1]
        for j in lst:
            if largest in j:
                lst.remove(j)
                new.append(j)
    return new


def sort_age(lst):
    newlist = []
    if lst == []:
        return []
    for i in lst :
        if newlist == []:
            newlist = i
        elif i[1] > newlist[1] :
            newlist = i
    lst.remove(newlist)
    return [newlist] + sort_age(lst)

    pass


def sort_age(lst):
    new_lst = []
    while lst:
        oldest = lst[0]
        for i in range(len(lst)):
            if lst[i][1] > oldest[1]:
                oldest = lst[i]
        lst.remove(oldest)
        new_lst.append(oldest)
    return new_lst


def sort_age(lst):
    sort = []
    while lst:
        smallest = lst[0]
        for element in lst:
            if element[1] > smallest[1]:
                smallest = element
        lst.remove(smallest)
        sort.append(smallest)
    return sort


def sort_age(lst):
    result = []
    while lst !=[]:
        lowest = lst[0][1]
        index = 0
        for i in range(1,len(lst)):
            if lst[i][1]<lowest:
                index = i
                lowest = lst[i][1]
        result = [lst[index]] + result
        lst.pop(index)
    return result


def sort_age(lst):
    old_lst = lst
    new_lst = []
    while old_lst:
        largest = old_lst[0][1]
        remove = old_lst[0]
        for i in lst:
            if i[1] > largest:
                largest = i[1]
                remove = i
        old_lst.remove(remove)
        new_lst.append(remove)
    return new_lst


def sort_age(lst):
    sort = []
    while lst:
        biggest = lst[0]
        for element in lst:
            if element[1] > biggest[1]:
                biggest = element
        lst.remove(biggest)
        sort.append(biggest)
    return sort


def sort_age(lst):
    if len(lst) == 0:
        return []
    elif len(lst) == 1:
        return lst
    elif len(lst) == 2:
        if lst[0][1] >= lst[1][1]:
            return lst
        else:
            return [lst[1], lst[0]]
    else:
        if lst[0][1] >= lst[1][1]:
            list1, list2 = [lst[0]], [lst[1]]
        else:
            list1, list2 = [lst[1]], [lst[0]]
        for i in lst[2:]:
            if i[1] >= list1[0][1]:
                list1.append(i)
            else:
                list2.append(i)
        return sort_age(list1) + sort_age(list2)


def sort_age(lst):
    sort = []
    while lst:
        oldest = lst[0]
        for person in lst:
            if person[1] >= oldest[1]:
                oldest = person
        lst.remove(oldest)
        sort.append(oldest)
    return sort


def sort_age(lst):
    answer = []
    while lst:
        largest = lst[0]
        for entry in lst:
            if entry[1] > largest[1]:
                largest = entry
        answer.append(largest)
        lst.remove(largest)
    return answer


def quicksort(lst, f):
    if len(lst) <= 1:
        return lst

    pivot_ind = len(lst)//2
    pivot = lst[pivot_ind]

    flist, blist = [], []
    for i in range(len(lst)):
        if i == pivot_ind:
            continue
        if f(lst[i]) <= f(pivot):
            flist.append(lst[i])
        else:
            blist.append(lst[i])

    finalsort = quicksort(flist, f) + [pivot] + quicksort(blist, f)
    return finalsort

def sort_age(lst):
    return quicksort(lst, lambda x: x[1])[::-1]


def sort_age(lst):
    a=lst
    sort=[]
    while a:
        smallest=a[0]
        for element in a:
            if element[1]<smallest[1]:
                smallest=element
        a.remove(smallest)
        sort.append(smallest)
    sort.reverse()
    return sort


def sort_age(lst):
    sort=[]
    while lst:
        biggest=lst[0]
        for element in lst:
            if element[1] > biggest[1]:
                biggest=element
        lst.remove(biggest)
        sort.append(biggest)
    return sort


def sort_age(lst):
    if lst==[]:
        return []
    sort=[]
    while lst:
        largest = lst[0]
        for i in lst:
            if i[1] > largest[1]:
                largest = i
        lst.remove(largest)
        sort.append(largest)
    return sort
    pass


def sort_age(lst):
    if len(lst) == 0:
        return []
    elif len(lst) == 1:
        return lst
    else:
        mid = len(lst) // 2
        lst1 = sort_age(lst[:mid])
        lst2 = sort_age(lst[mid:])

        result = []
        while lst1 and lst2:
            if lst1[0][1] < lst2[0][1]:
                result.append(lst2.pop(0))
            else:
                result.append(lst1.pop(0))
        result.extend(lst1)
        result.extend(lst2)

        return result


def sort_age(lst):
    product = []
    while lst:
        largest = lst[0]
        for i in lst:
            if i[1]>largest[1]:
                largest = i
        lst.remove(largest)
        product.append(largest)
    return product


def sort_age(lst):
    for i in range(0,len(lst)):
        this=lst[i]
        j=0
        while j<i:
            if this[1]>lst[j][1]:
                break
            j+=1
        del lst[i]
        lst.insert(j,this)
    return lst


def sort_age(lst):
    sort = []

    while len(lst) > 0:
        largest = lst[0]
        for i in lst:
            if i[1] > largest[1]:
                largest = i

        lst.remove(largest)
        sort.append(largest)

    return sort


def sort_age(lst):
    result = []
    while lst:
        biggest = lst[0]
        for element in lst:
            if element[1] > biggest[1]:
                biggest = element
        lst.remove(biggest)
        result.append(biggest)
    return result


def sort_age(lst):
    newlst = []
    while lst:
        largest = lst[0]
        for el in lst:
            if el[1] > largest[1]:
                largest = el
        newlst.append(largest)
        lst.remove(largest) #when it repeats, largest will take on the new first element in lst
    return newlst


def sort_age(lst):
    rslt=[]
    while lst:
        smallest=lst[0]
        for element in lst:
            if element[1]>smallest[1]:
                smallest=element
        lst.remove(smallest)
        rslt.append(smallest)
    return rslt


def sort_age(lst):
    for i in range(len(lst)-1):
        for j in range(i+1, len(lst)):
            if lst[i][1] < lst[j][1]:
                lst[i], lst[j] = lst[j], lst[i]
    return lst


def sort_age(lst):
    sort = []
    while lst:
        largest = lst[0]
        largestx = lst[0][1]
        for element in lst:
            if element[1] > largestx:
                largestx = element[1]
                largest = element
        lst.remove(largest)
        sort.append(largest)
    return sort


def sort_age(lst):
    result=[]
    while lst:
        biggest=lst[0][1]
        tuple_biggest=lst[0]
        for i in lst:
            if i[1]>biggest:
                biggest=i[1]
                tuple_biggest=i
        lst.remove(tuple_biggest)
        result.append(tuple_biggest)
    return result


def sort_age(lst):
    new_lst = []
    while lst:
        max_age = lst[0]
        for tpl in lst:
            if tpl[1] > max_age[1]:
                max_age = tpl
        new_lst.append(max_age)
        lst.remove(max_age)
    return new_lst


def sort_age(lst):
    sorted1 = []
    while lst:
        largest = lst[0]
        for element in lst:
            if element[1] > largest[1]:
                largest = element
        lst.remove(largest)
        sorted1.append(largest)
    return sorted1


def sort_age(lst):
    result = []
    while lst != []:
        largest_tup = lst[0]
        largest = lst[0][1]
        for i in lst:
            if i[1] > largest:
                largest_tup = i
                largest = i[1]
        lst.remove(largest_tup)
        result.append(largest_tup)
    return result


def sort_age(lst):
    sort_list = []
    while lst: # a is not []
        biggest = lst[0]
        for element in lst:
            if element[1] > biggest[1]:
                biggest = element
        lst.remove(biggest)
        sort_list.append(biggest)
    return sort_list


def sort_age(lst):
    tmp = []
    ages = [x[1] for x in lst]
    while len(ages) > 0:
        age = max(ages)
        for x in lst:
            if x[1] == age:
                tmp.append(x)
                ages.remove(age)
                continue
    return tmp


def sort_age(lst):
    males, females = [], []
    for i in lst:
        if i[0] == "M":
            males = males + [lst[0],]
        elif i[0] == "F":
            females = females + [lst[0],]
        lst = lst[1:]
    return merge(merge_sort(males), merge_sort(females))

def merge(left, right):
    results = []
    while left and right:
        if left[0][1] > right[0][1]:
            results.append(left.pop(0))
        else:
            results.append(right.pop(0))
    results.extend(left)
    results.extend(right)
    return results

def merge_sort(lst):
    if len(lst) < 2:
        return lst
    mid = len(lst) // 2
    left = merge_sort(lst[:mid])
    right = merge_sort(lst[mid:])
    return merge(left, right)


def sort_age(lst):
    sort = []
    while lst:
        biggest = lst[0]
        for element in lst:
            if element[1] > biggest[1]:
                biggest = element
        lst.remove(biggest)
        sort.append(biggest)
    return sort


def sort_age(lst):
    new=[]
    while lst !=[]:
        big=lst[0]
        for i in lst:
            if i[1]>big[1]:
                big=i
        lst.remove(big)
        new.append(big)
    return new


def sort_age(lst):
    sort = []
    while lst:
        biggest = lst[0][1]
        element=lst[0]
        for ele in lst:
            if ele[1] > biggest:
                biggest = ele[1]
                element=ele
        lst.remove(element)
        sort.append(element)
    return sort


def sort_age(lst):
    result = []
    while lst:
        heights= map(lambda x:x[1],lst)
        tall=max(heights)
        person=list(filter(lambda x:x[1]==tall,lst))
        result += person
        lst.remove(person[0])
    return result


def sort_age(lst):
    for i in range(0,len(lst)):
        this=lst[i]
        j=0
        while j<i:
            if this[1]>lst[j][1]:
                break
            j+=1
        del lst[i]
        lst.insert(j,this)
    return lst


def sort_age(lst):
    old_lst = lst
    new_lst = []
    while old_lst:
        largest = old_lst[0][1]
        remove = old_lst[0]
        for i in lst:
            if i[1] > largest:
                largest = i[1]
                remove = i
        old_lst.remove(remove)
        new_lst.append(remove)
    return new_lst


def sort_age(lst):
    for i in range(len(lst)):
        position = i
        biggest = position
        for a in range(position, len(lst)):
            if lst[a][1] > lst[biggest][1]:
                biggest = a
        tmp = lst[position]
        lst[position] = lst[biggest]
        lst[biggest] = tmp
    return lst


def sort_age(lst):
    if len(lst) == 1:
        return lst
    else:
        new_list = []
        while lst:
            minimum = lst[0]
            for i in lst:
                if i[1] < minimum[1]:
                    minimum = i
            new_list.append(minimum)
            lst.remove(minimum)
        return new_list[::-1]


def sort_age(lst):
    product = []
    while lst:
        largest = lst[0]
        for i in lst:
            if i[1]>largest[1]:
                largest = i
        lst.remove(largest)
        product.append(largest)
    return product


def sort_age(lst):
    new_lst = []
    while lst:
        oldest = lst[0]
        for a in lst:
            if a[1] > oldest[1]:
                oldest = a
        lst.remove(oldest)
        new_lst.append(oldest)
    return new_lst


def sort_age(lst):
    for loop in range(len(lst)):
        for i in range(len(lst)-1):
            if lst[i][1]<lst[i+1][1]:
                lst[i],lst[i+1]=lst[i+1],lst[i]
    return lst


def sort_age(lst):
    def for_age(lst):
        for i in range(len(lst)):
            if i == 0: continue
            else:
                while i > 0:
                    if lst[i][1] < lst[i-1][1]:
                        lst[i], lst[i-1] = lst[i-1], lst[i]
                        i -= 1
                    else: i = 0
    for_age(lst)
    lst.reverse()
    return lst


def sort_age(lst):
    # Fill in your code here
    new_lst = []
    while lst:
        oldest = lst[0]
        for i in range(len(lst)):
            if lst[i][1] > oldest[1]:
                oldest = lst[i]
        lst.remove(oldest)
        new_lst.append(oldest)

    return new_lst


def sort_age(lst):
    holder=[]
    if lst==[]:
        return []
    for x in lst:
        if holder==[]:
            holder=x
        elif x[1]>holder[1]:
            holder=x
    lst.remove(holder)
    return [holder]+sort_age(lst)


def sort_age(lst):

    people = []

    while lst:

        i = lst[0]

        for a in lst:

            if a[1] >= i[1] :

                i = a

        lst.remove(i)

        people.append(i)

    return people


def sort_age(lst):
    if len(lst) == 0:
        return []
    elif len(lst) == 1:
        return lst
    else:
        mid = len(lst) // 2
        lst1 = sort_age(lst[:mid])
        lst2 = sort_age(lst[mid:])

        result = []
        while lst1 and lst2:
            if lst1[0][1] < lst2[0][1]:
                result.append(lst2.pop(0))
            else:
                result.append(lst1.pop(0))
        result.extend(lst1)
        result.extend(lst2)

        return result


def sort_age(lst):
    sort = []
    while lst:
        oldest = lst[0]
        for i in lst[1:]:
            if i[1] > oldest[1]:
                oldest = i
        lst.remove(oldest)
        sort.append(oldest)
    return sort


def sort_age(lst):
    a=lst
    sort=[]
    while a:
        smallest=a[0]
        for element in a:
            if element[1]<smallest[1]:
                smallest=element
        a.remove(smallest)
        sort.append(smallest)
    sort.reverse()
    return sort


def sort_age(lst):
    oldtoyoung=[]
    while lst:
        younger=lst[0]
        for older in lst:
            if older[1]>younger[1]:
                younger=older
        lst.remove(younger)
        oldtoyoung.append(younger)
    return oldtoyoung


def sort_age(lst):
    sort = []
    while lst:
        largest = lst[0]
        for element in lst:
            if element[1] > largest[1]:
                largest = element
        lst.remove(largest)
        sort.append(largest)
    return sort


def sort_age(lst):
    sort = []
    while lst:
        oldest = lst[0]
        for i in lst:
            if i[1] > oldest[1]:
                oldest = i
        lst.remove(oldest)
        sort.append(oldest)
    return sort


def sort_age(lst):

    sort_lst = []

    while lst:
        smallest = lst[0]
        for e in lst:
            if e[1] < smallest[1]:
                smallest = e
        lst.remove(smallest)
        sort_lst.append(smallest)

    return sort_lst[::-1]


def sort_age(lst):
    output = []
    while lst:
        largest = lst[0]
        for i in lst:
            if i[1] > largest[1]:
                largest = i
        lst.remove(largest)
        output.append(largest)
    return output


def sort_age(lst):
    all_age = []
    for person in lst:
        all_age += [person[1],]
    result = []
    while len(result) < len(lst):
        for person in lst:
            if person[1] == max(all_age):
                result += (person,)
        all_age.remove(max(all_age))
    return result


def sort_age(lst):
    if lst == []:
        return []
    else:
        result = [lst[0]]
        for i in lst[1:]:
            if i[1] > result[0][1]:
                result.insert(0, i)
            elif i[1] < result[-1][1]:
                result.append(i)
            else:
                for j in range(len(result) - 1):
                    if i[1] < result[j][1] and i[1] > result[j+1][1]:
                        result.insert(j+1, i)
        return result


def sort_age(lst):
    sort = []
    while lst:
        oldest = lst[0]
        for i in lst:
            if i[1]>oldest[1]:
                oldest = i
        lst.remove(oldest)
        sort.append(oldest)
    return sort


def sort_age(lst):
    lst1=[]
    while lst:
        smallest=lst[0]
        for ele in lst:
            if ele[1]>smallest[1]:
                smallest=ele
        lst.remove(smallest)
        lst1.append(smallest)
    return lst1


def sort_age(lst):
    if len(lst) == 1:
        return lst
    elif lst == []:
        return []
    else:
        s = 0
        for i in lst:
            if i[1] > s:
                s = i[1]
                t = i
        lst.remove(t)
        return [t] + sort_age(lst)


def sort_age(lst):
    l = len(lst)
    for i in range(l):
        largest = lst[i]
        for j in range(i+1,l):
            if lst[j][1] > largest[1]:
                largest = lst[j] #assign new largest value
                lst[i],lst[j] = lst[j],lst[i] #swap positions if larger
        #print(i,lst)
    return lst


def sort_age(lst):
    newlst=[]
    while lst:
        oldest = lst[0][1] #first age
        for person in lst:
            if person[1]>oldest:
                oldest=person[1]
        for person in lst:
            if person[1]==oldest:
                newlst.append(person)
                lst.remove(person)
    return newlst


def sort_age(lst):
    def cmp(a,b):
        if a[1] >= b[1]:
            return True
        else:
            return False

    while True:
        sorted = True
        for i in range(len(lst)-1):
            if not cmp(lst[i],lst[i+1]):
                lst[i],lst[i+1]=lst[i+1],lst[i]
                sorted = False
        if sorted==True:
            break

    return lst


def sort_age(lst):
    sort = True
    while sort:
        sort = False
        for i in range(len(lst)-1):
            if lst[i][1] < lst[i+1][1]:
                sort = True
                lst[i], lst[i+1] = lst[i+1], lst[i]
    return lst


def sort_age(lst):
    a = []
    b = lst.copy()
    lst.clear()
    for i in b:
        a += [i[1]]
    for i in range(len(a)):
            for i in range(len(a)):
                if a[i] == min(a):
                    if b[i] not in lst:
                        lst.append(b[i])
                        a[i] = (max(a) +1)
    lst.reverse()
    return lst

# sort will work for tuples


def sort_age(lst):
    new=[]
    while lst !=[]:
        big=lst[0]
        for i in lst:
            if i[1]>big[1]:
                big=i
        lst.remove(big)
        new.append(big)
    return new


def sort_age(lst):
    sort = []
    while lst:
        smallest = lst[0]
        for element in lst:
            if element[1] > smallest[1]:
                smallest = element
        lst.remove(smallest)
        sort.append(smallest)
    return sort

    pass


def sort_age(lst):
    sort=[]
    while lst:
        oldest=lst[0]
        for element in lst:
            if element[1]>oldest[1]:
                oldest=element
        lst.remove(oldest)
        sort.append(oldest)
    return sort


def sort_age(lst):
    new =[]
    while lst:
        index = 0
        oldest = lst[0][1]
        for i in range(1, len(lst)):
            if lst[i][1] >oldest:
                oldest = lst[i][1]
                index = i
        new.append(lst[index])
        del lst[index]
    return new


def sort_age(lst):
    # Fill in your code here
    new_lst = [('A',10000),('B',0)]
    for element in lst:
        age = element[1]
        for i in range(len(new_lst)):
            if age > new_lst[i][1]:
                new_lst.insert(i, element)
                break
    new_lst.remove(('A',10000))
    new_lst.remove(('B',0))
    return new_lst


def sort_age(lst):
    if len(lst) == 1:
        return lst
    sort = []
    while lst:
        tup = lst[0]
        smallest = lst[0][1]
        for element in lst:
            if element[1] > smallest:
                smallest = element[1]
                tup = element
        lst.remove(tup)
        sort.append(tup)
    return sort


def sort_age(lst):
    result = []
    while lst:
        largest = lst[0]
        for i in lst:
            if i[1] > largest[1]:
                largest = i
        lst.remove(largest)
        result.append(largest)
    return result
    pass


def sort_age(lst):
    new_lst = []
    age = []
    for i in lst:
        age = age + [i[1],]
    while len(lst) != 0:
        for j in lst:
            if j[1] == max(age):
                lst.remove(j)
                age.remove(max(age))
                new_lst = new_lst + [j,]

    return new_lst


def sort_age(lst):
    n = len(lst)
    result = []
    while n != 0:
        test = []
        for counter in range(n):
            test.append(lst[counter][1])
        first = max(test)
        for counter in range(n):
            if counter == len(lst):
                break
            elif lst[counter][1] == first:
                result.append(lst.pop(counter))
        n = len(lst)
    return result


def sort_age(lst):
    decoy = []
    decoy2 = []
    final = []
    for i in lst:
        decoy.append(i[1])
    while decoy != []:
        decoy2.append(max(decoy))
        decoy.remove(max(decoy))
    for i in decoy2:
        for j in lst:
            if i == j[1]:
                final.append(j)
    return final


def sort_age(lst):
    a = lst
    sort = []
    while a:
        largest = a[0]
        for item in a:
            if item[1] >largest[1]:
                largest = item
        a.remove(largest)
        sort.append(largest)

    return(sort)# Fill in your code here


def sort_age(lst):
    result = []
    while lst:
        oldest = lst[0]
        for people in lst:
            if people[1] > oldest[1]:
                oldest = people
        lst.remove(oldest)
        result += (oldest,)
    return result


def sort_age(lst):
    if lst==[]:
        return []
    sort=[]
    while lst:
        largest = lst[0]
        for i in lst:
            if i[1] > largest[1]:
                largest = i
        lst.remove(largest)
        sort.append(largest)
    return sort
    pass


def sort_age(lst):
    newlst = []
    while lst:
        current = lst[0]
        for element in lst:
            if element[1] > current[1]:
                current = element
        newlst += (current,)
        lst.remove(current)
    return newlst


def sort_age(lst):
    new_list = []
    while lst:
        smallest = lst[0]
        for element in lst:
            if smallest[1]<element[1]:
                smallest = element
        lst.remove(smallest)
        new_list.append(smallest)
    return new_list


def sort_age(lst):
    # Fill in your code here
    sorted = []
    while lst:
        oldest = lst[0]
        for i in range(len(lst)):
            if lst[i][1] > oldest[1]:
                oldest = lst[i]
        sorted.append(oldest)
        lst.remove(oldest)
    return sorted


def sort_age(lst):
    result=[]
    while lst:
        largest=lst[0][1]
        tuple_largest=lst[0]
        for i in lst:
            if i[1]>largest:
                largest=i[1]
                tuple_largest=i
        lst.remove(tuple_largest)
        result.append(tuple_largest)
    return result


def sort_age(lst):
    sorted_lst = []
    while lst:
        smallest = lst[0]
        for i in lst:
            if i[1] < smallest[1]:
                smallest = i
        lst.remove(smallest)
        sorted_lst.append(smallest)
    sorted_lst.reverse()
    return sorted_lst


def sort_age(lst):
    res = []
    a=age_list(lst)
    while lst:
        for i in lst:
            if max(a) == i[1]:
                highest=i
                res= res + [i]
        lst.remove(highest)
        a.remove(highest[1])
    return res

def age_list(lst):
    age_list= []
    for i in range(len(lst)):
        age_list = age_list+ [lst[i][1]]
    return age_list


def sort_age(lst):
    result = []
    while lst:
        biggest = lst[0]
        for element in lst:
            if element[1] > biggest[1]:
                biggest = element
        lst.remove(biggest)
        result.append(biggest)
    return result


def sort_age(lst):

    sort_lst = []

    while lst:
        smallest = lst[0]
        for e in lst:
            if e[1] < smallest[1]:
                smallest = e
        lst.remove(smallest)
        sort_lst.append(smallest)

    return sort_lst[::-1]


def sort_age(lst):
    if lst == []:
        return []
    else:
        result = [lst[0]]
        for i in lst[1:]:
            if i[1] > result[0][1]:
                result.insert(0, i)
            elif i[1] < result[-1][1]:
                result.append(i)
            else:
                for j in range(len(result) - 1):
                    if i[1] < result[j][1] and i[1] > result[j+1][1]:
                        result.insert(j+1, i)
        return result


def sort_age(lst):
    output = []
    while lst:
        largest = lst[0]
        for i in lst:
            if i[1] > largest[1]:
                largest = i
        lst.remove(largest)
        output.append(largest)
    return output


def sort_age(lst):
    order = []
    while lst:
        oldest = lst[0]
        for person in lst:
            if person[1] > oldest[1]:
                oldest = person
        lst.remove(oldest)
        order.append(oldest)
    return order


def sort_age(lst):
    new=[]
    while lst:
        biggest=lst[0]
        for element in lst:
            if element[1]>biggest[1]:
                biggest=element

        lst.remove(biggest)
        new.append(biggest)
    return new


def sort_age(lst):
    sortt = [] #empty list
    while lst:
        largest = lst[0] #let the first element be the largest first
        for i in lst:
            if i[1] > largest[1]:
                largest = i
        lst.remove(largest)
        sortt.append(largest)
    return sortt


def sort_age(lst):
    # Fill in your code here
    i = 1
    while i < len(lst):
        j = i
        while j>0 and lst[j-1][1] > lst[j][1]:
            lst[j], lst[j-1] = lst[j-1], lst[j]
            j-=1
        i+=1
    return lst[::-1]


def sort_age(lst):
    arranged = []
    while lst:
        oldest = lst[0]
        for person in lst:
            if person[1] > oldest[1]:
                oldest = person
        lst.remove(oldest)
        arranged.append(oldest)
    return arranged
    pass


def sort_age(lst):
    final=[]
    while lst:
        old=lst[0]
        for i in lst:
            if old[1]<i[1]:
                old=i
        lst.remove(old)
        final.append(old)
    return final


def sort_age(lst):
    sort=[]
    while lst:
        oldest=lst[0]
        for element in lst:
            if element[1]>oldest[1]:
                oldest=element
        lst.remove(oldest)
        sort.append(oldest)
    return sort


def sort_age(lst):
    ages = list(i[1] for i in lst)

    for i in range(len(lst)):
        index_youngest = ages.index(max(ages))
        lst[i], lst[index_youngest] = lst[index_youngest], lst[i]
        ages[index_youngest] = min(ages) - 1
        ages[i], ages[index_youngest] = ages[index_youngest], ages[i]

    return lst


def sort_age(lst):
	final = []
	while lst:
		biggest = lst[0]
		for i in lst:
			if i[1] > biggest[1]:
				biggest = i
		lst.remove(biggest)
		final.append(biggest)
	return final


def sort_age(lst):
    new = []
    while lst:
        largest = lst[0][1]
        for i in lst:
            if i[1]>largest:
                largest = i[1]
        tpl = ()
        for j in lst:
            if j[1] == largest:
                tpl = j
        lst.remove(tpl)
        new.append(tpl)
    return new


def sort_age(lst):
    newlst=[]
    while lst:
        oldest = lst[0][1] #first age
        for person in lst:
            if person[1]>oldest:
                oldest=person[1]
        for person in lst:
            if person[1]==oldest:
                newlst.append(person)
                lst.remove(person)
    return newlst


def sort_age(lst):
    new =[]
    while lst:
        index = 0
        oldest = lst[0][1]
        for i in range(1, len(lst)):
            if lst[i][1] >oldest:
                oldest = lst[i][1]
                index = i
        new.append(lst[index])
        del lst[index]
    return new


def sort_age(lst):
    new_lst = []
    while lst:
        max_num = lst[0]
        for i in lst:
            if i[1] > max_num[1]:
                max_num = i
        lst.remove(max_num)
        new_lst.append(max_num)
    return new_lst


def sort_age(lst):
	newlst=[]
	while lst:
		minimum1=lst[0]
		minimum=lst[0][1]
		for x in lst:
			if x[1]>minimum:
				minimum=x[1]
				minimum1=x
		newlst.append(minimum1)
		lst.remove(minimum1)
	return newlst


def sort_age(lst):
	new = []
	while lst:
		small = lst[0]
		for a in lst:
			if a > small and a[1] > small[1]:
				small = a
		new.append(small)
		lst.remove(small)
	return new


def sort_age(lst):
    newlst = []
    while lst:
        current = lst[0]
        for element in lst:
            if element[1] > current[1]:
                current = element
        newlst += (current,)
        lst.remove(current)
    return newlst


def sort_age(lst):
    sort = []
    while lst:
        biggest = lst[0]
        for k in lst:
            if k[1] > biggest[1]:
                biggest = k
        lst.remove(biggest)
        sort.append(biggest)
    return sort


def sort_age(lst):
    result = []
    while lst:
        oldest = lst[0]
        for people in lst:
            if people[1] > oldest[1]:
                oldest = people
        lst.remove(oldest)
        result += (oldest,)
    return result


def sort_age(lst):
    # Fill in your code here
    a = []
    for i in lst:
        if a ==[]:
            a.append(i)
            continue
        else:
            for k in range(0,len(lst)):
                if i[1]>a[0][1]:
                    a.insert(0,i)
                    break
                elif a[-1][1]>i[1]:
                    a.insert(len(lst),i)
                    break
                elif i[1] > a[k+1][1] and i[1]<a[k][1]:
                    a.insert(k+1,i)
                    break
    return a


def sort_age(lst):
    if len(lst) < 2:
        return lst
    new_lst = []
    while lst:
        max_age = lst[0][1]
        first = lst[0]
        for j in range(1, len(lst)):
            if lst[j][1] > max_age:
                max_age = lst[j][1]
                first = lst[j]
        new_lst.append(first)
        lst.remove(first)
    return new_lst


def sort_age(lst):
    # Fill in your code here
    new_lst = []
    while lst:
        oldest = lst[0]
        for i in range(len(lst)):
            if lst[i][1] > oldest[1]:
                oldest = lst[i]
        lst.remove(oldest)
        new_lst.append(oldest)

    return new_lst


def sort_age(lst):
    arranged = []
    while lst:
        oldest = lst[0]
        for person in lst:
            if person[1] > oldest[1]:
                oldest = person
        lst.remove(oldest)
        arranged.append(oldest)
    return arranged
    pass


def sort_age(lst):
	for i in range(0,len(lst)-1):
		   for j in range(i+1,len(lst)):
			   if lst[i][1]<lst[j][1]:
				   lst[i],lst[j]=lst[j],lst[i]
	return lst


def sort_age(lst):
    order = []
    while lst:
        oldest = lst[0]
        for person in lst:
            if person[1] > oldest[1]:
                oldest = person
        lst.remove(oldest)
        order.append(oldest)
    return order


def sort_age(lst):
    sort = []
    while lst:
        biggest = lst[0]
        for element in lst:
            if element[1] > biggest[1]:
                biggest = element
        lst.remove(biggest)
        sort.append(biggest)
    return sort


def sort_age(lst):
	newlst = []
	while lst:
		oldest = lst[0]
		for element in lst:
			if element[1] > oldest[1]:
				oldest = element
		lst.remove(oldest)
		newlst.append(oldest)
	return newlst


def sort_age(lst):
    final=[]
    while lst:
        old=lst[0]
        for i in lst:
            if old[1]<i[1]:
                old=i
        lst.remove(old)
        final.append(old)
    return final


def sort_age(lst):
    new_lst = []
    age = []
    for i in lst:
        age = age + [i[1],]
    while len(lst) != 0:
        for j in lst:
            if j[1] == max(age):
                lst.remove(j)
                age.remove(max(age))
                new_lst = new_lst + [j,]

    return new_lst


def sort_age(lst):
    answer = []
    while lst:
        largest = lst[0]
        for entry in lst:
            if entry[1] > largest[1]:
                largest = entry
        answer.append(largest)
        lst.remove(largest)
    return answer


def sort_age(lst):
    sort=[]
    while lst:
        smallest = lst[0]
        for i in lst:
            if i[1] < smallest[1]:
                smallest = i
        sort.append(smallest)
        lst.remove(smallest)
    sort.reverse()
    return sort


def sort_age(lst):
    rslt=[]
    while lst:
        smallest=lst[0]
        for element in lst:
            if element[1]>smallest[1]:
                smallest=element
        lst.remove(smallest)
        rslt.append(smallest)
    return rslt


def sort_age(lst):
	result=[]
	def lame(lst):
		loser=0
		list_of_numbers=[]
		x=len(lst)
		if lst==[]:
			return result
		for i in range(x):
			list_of_numbers+=[lst[i][1]]
		y=max(list_of_numbers)
		for i in lst:
			if i[1]==y:
				loser=i
		result.append(loser)
		lst.remove(loser)
		return lame(lst)
	return lame(lst)


def sort_age(lst):
    result = []
    while lst:
        biggest = lst[0]
        for e in lst:
            if e[1] > biggest[1]:
                biggest = e
        result.append(biggest)
        lst.remove(biggest)
    return result


def sort_age(lst):
    sort = []
    while lst:
        largest = lst[0]
        for i in lst:
            if largest[1] < i[1]:
                largest = i
            else:
                continue
        lst.remove(largest)
        sort.append(largest)
    return sort


def sort_age(lst):
    sort = []
    while lst:
        largest = lst[0]
        for element in lst:
            if element[1] > largest[1]:
                largest = element
        lst.remove(largest)
        sort.append(largest)
    return sort


def sort_age(lst):
    slist = []
    while lst:
        elder = lst[0]
        for i in range(len(lst)):
            if lst[i][1] > elder[1]:
                elder = lst[i]
            else:
                continue
        slist.append(elder)
        lst.remove(elder)
    return slist


def sort_age(lst):
    sort = []
    while lst:
        oldest = lst[0]
        for i in lst[1:]:
            if i[1] > oldest[1]:
                oldest = i
        lst.remove(oldest)
        sort.append(oldest)
    return sort


def sort_age(lst):
    if len(lst) < 2:
        return lst
    for j in range(len(lst)-1):
        minimum = j
        for i in range(j+1, len(lst)):
            if lst[minimum][1] > lst[i][1]:
                minimum = i
        lst[j], lst[minimum] = lst[minimum], lst[j]
    lst.reverse()
    return lst


def sort_age(lst):
	new_lst = []
	while lst:
		oldest = lst[0][1]
		for people in lst:
			if people[1] >= oldest:
				oldest = people[1]
				remove_people = people
		new_lst.append(remove_people)
		lst.remove(remove_people)
	return new_lst


def sort_age(lst):
    # Fill in your code here
    sorted_list = []
    while lst:
        tpl = lst[0]
        gender = lst[0][0]
        oldest = lst[0][1]
        for i in lst:
            if i[1] > oldest:
                oldest = i[1]
                tpl = i
                gender = i[0]
        lst.remove(tpl)
        sorted_list.append((gender, oldest))
    return sorted_list


def sort_age(lst):
    sort=[]
    while lst:
        largest=lst[0]
        for i in lst:
            if i[1]>largest[1]:
                largest=i
        lst.remove(largest)
        sort.append(largest)
    return sort

#    lst.sort(key= lambda x:x[1], reverse=True)
 #   return lst


def sort_age(lst):
    holder=[]
    if lst==[]:
        return []
    for x in lst:
        if holder==[]:
            holder=x
        elif x[1]>holder[1]:
            holder=x
    lst.remove(holder)
    return [holder]+sort_age(lst)


#def sort_age(lst):
#    lst.sort(key=lambda x: x[1],reverse=True)
#    return lst

def sort_age(lst):
    a=lst
    sort=[]
    while a:
        largest=a[0]
        for i in a:
            if i[1]>largest[1]:
                largest=i
        a.remove(largest)   #1.indentation!
        sort.append(largest)
    return sort

#1.it's same indentation as for loop,
    #that is, we only start removing when we find the largest


def sort_age(lst):
    for i in range(len(lst)):
        position = i
        biggest = position
        for a in range(position, len(lst)):
            if lst[a][1] > lst[biggest][1]:
                biggest = a
        tmp = lst[position]
        lst[position] = lst[biggest]
        lst[biggest] = tmp
    return lst


def sort_age(lst):
    sort = []
    while lst:
        oldest = lst[0]
        for x in lst:
            if x[1] > oldest[1]:
                oldest = x
        lst.remove(oldest)
        sort.append(oldest)
    return sort


def sort_age(lst):
    # Fill in your code here
    if lst == []:
        return lst

    out = [lst[0],]
    for ele in lst[1:]:
        for indx in range(len(out)):
            if out[indx][1] < ele[1]:
                out.insert(indx, ele)
                break
            elif indx == len(out) - 1:
                out.append(ele)
    return out


def sort_age(lst):
	sort = []
	while lst:
		largest = lst[0]
		for element in lst:
			if element[1] > largest[1]:
				largest = element
		lst.remove(largest)
		sort.append(largest)
	return sort


def sort_age(lst):
    sort1 = []
    while lst:
        largest = lst[0]
        for i in lst:
            if i[1] > largest[1]:
                largest = i
        lst.remove(largest)
        sort1.append(largest)
    return sort1


def sort(lst):
    for i in range(len(lst)-1):
        if lst[i][1] > lst[i+1][1]:
            temp = lst[i]
            del lst[i]
            lst += [temp]
        else:
            continue
    return lst

def sort_age(lst):
    oldlist = tuple(lst)
    if tuple(sort(lst)) == oldlist:
        lst.reverse()
        return lst
    else:
        sort(lst)
        return sort_age(lst)


def sort_age(lst):
    new_list = []
    while lst:
        smallest = lst[0]
        for element in lst:
            if smallest[1]<element[1]:
                smallest = element
        lst.remove(smallest)
        new_list.append(smallest)
    return new_list


def sort_age(lst):
    lst_len = len(lst) - 1
    while lst_len > 0:
        for i in range(lst_len):
            if lst[i][1] > lst[i+1][1]:
                lst[i], lst[i+1] = lst[i+1], lst[i]
        lst_len -= 1
    return lst[::-1]


def sort_age(lst):
    ages=[]
    for j in lst:
        ages.append(j[1])
    ages=sort(ages)
    new_lst=[]
    for age in ages:
        for i in lst:
            if age==i[1]:
                new_lst.append(i)
    return new_lst

def sort(lst):
    age=[]
    while lst:
        largest=lst[0]
        for elem in lst:
            if elem > largest:
                largest = elem
        lst.remove(largest)
        age.append(largest)
    return age


def sort_age(lst):
    new = []
    while lst:
        largest = lst[0][1]
        for i in lst:
            if i[1]>largest:
                largest = i[1]
        tpl = ()
        for j in lst:
            if j[1] == largest:
                tpl = j
        lst.remove(tpl)
        new.append(tpl)
    return new


def sort_age(lst):
    sort = []
    while lst:
        biggest = lst[0]
        for k in lst:
            if k[1] > biggest[1]:
                biggest = k
        lst.remove(biggest)
        sort.append(biggest)
    return sort


def sort_age(lst):
    new = []
    while lst:
        small = lst[0][1]
        name =lst[0][0]
        for ele in lst:
            if ele[1]>small:
                small = ele[1]
                name = ele[0]
        new.append((name,small))
        lst.remove((name,small))
    return new


def sort_age(lst):
    sorted = []
    while lst:
        biggest = lst[0]
        for elem in lst:
            if elem[1] > biggest[1]:
                biggest = elem
        lst.remove(biggest)
        sorted.append(biggest)
    return sorted


def sort_age(lst):
    n = len(lst)-1
    for i in range(0,n):
        for j in range(i+1,len(lst)):
            if lst[i][1]<lst[j][1]:
                lst[i],lst[j]=lst[j],lst[i]
    return lst


def sort_age(lst):
    sort = []
    while lst:
        largest = lst[0]
        for i in lst:
            if i[1] > largest[1]:
                largest = i
        lst.remove(largest)
        sort.append(largest)
    return sort


def sort_age(lst):
    if lst == []:
        return lst
    else:
        age_lst, new_lst = [], []
        for x in lst:
            age_lst.append(x[1])
        while age_lst:
            max_age = max(age_lst)
            for i in lst:
                if i[1] == max_age:
                    new_lst.append(i)
                    age_lst.remove(i[1])
        return new_lst
    pass


def sort_age(lst):
    sort = []

    while lst:
        largest_element = lst[0]
        largest_value = lst[0][1]
        for element in lst:
            if element[1] > largest_value:
                largest_element = element
                largest_value = element[1]
            else:
                continue
        lst.remove(largest_element)
        sort.append(largest_element)
    return sort


def sort_age(lst):
    if len(lst)== 0:
        return []
    def rank(lyst):
        if len(lyst)==1:
            return list(lyst)
        else:
            a = max(lyst)
            lyst.remove(a)
            return [a]+ rank(lyst)
    a = []
    b = []
    n = len(lst)
    for psn in lst:
        age = psn[1]
        a += [age]
        print(a)
    c = rank(a)
    for age in c:
        for psn in lst:
            if age == psn[1]:
                b += [psn]
            else:
                continue
    return b


def sort_age(lst):
    final = []
    temp = 0
    while lst:
        biggest = lst[0][1]
        for i in lst:
            if i[1]>=biggest:
                biggest = i[1]
                temp = i
        lst.remove(temp)
        final.append(temp)
    return final


def sort_age(lst):
    new = []
    while lst:
        Max = max(lst,key = lambda x : x[1])
        new.append(Max)
        lst.remove(Max)
    return new


def sort_age(lst):
    result = []
    while lst:
        largest = lst[0]
        for i in lst:
            if i[1] > largest[1]:
                largest = i
        lst.remove(largest)
        result.append(largest)
    return result
    pass


def sort_age(lst):
    ans = []
    while lst:
        biggest = lst[0]
        for elem in lst:
            if elem[1] > biggest[1]:
                biggest = elem
        lst.remove(biggest)
        ans.append(biggest)

    return ans


def sort_age(lst):
    new_lst = []
    while lst:
        oldest = lst[0]
        for i in range(len(lst)):
            if lst[i][1] > oldest[1]:
                oldest = lst[i]
        lst.remove(oldest)
        new_lst.append(oldest)
    return new_lst


def sort_age(lst):
    sort = []
    while lst:
        oldest = lst[0]
        for i in lst:
            if i[1] > oldest[1]:
                oldest = i
        lst.remove(oldest)
        sort.append(oldest)
    return sort
    # Fill in your code here


def sort_age(lst):
    newlst = []
    while lst:
        maximum = lst[0]
        for i in lst:
            if i[1]>maximum[1]:
                maximum = i
        newlst.append(maximum)
        lst.remove(maximum)
    return newlst


def sort_age(lst):
    # Fill in your code here
    if lst == []:
        return lst

    out = [lst[0],]
    for ele in lst[1:]:
        for indx in range(len(out)):
            if out[indx][1] < ele[1]:
                out.insert(indx, ele)
                break
            elif indx == len(out) - 1:
                out.append(ele)
    return out


def sort_age(lst):
    sort = []
    while lst:
        largest = lst[0]
        for element in lst:
            if element[1] > largest[1]:
                largest = element
        lst.remove(largest)
        sort.append(largest)
    return sort


def sort_age(lst):
    # Fill in your code here
    for i in range(0, len(lst)-1):
        for j in range(i+1, len(lst)):
            if lst[i][1] < lst[j][1]:
                lst[i],lst[j] = lst[j],lst[i]
    return lst


def sort_age(lst):
    sort=[]
    while lst:
        biggest=lst[0]
        for element in lst:
            if element[1] > biggest[1]:
                biggest=element
        lst.remove(biggest)
        sort.append(biggest)
    return sort


def sort_age(lst):
    list1 = []
    while lst:
        biggest = lst[0]

        for i in lst:
            if i[1] > biggest[1]:
                biggest = i

        lst.remove(biggest)
        list1.append(biggest)
    return list1


def sort_age(lst):
    lst1=[]
    while lst:
        smallest=lst[0]
        for ele in lst:
            if ele[1]>smallest[1]:
                smallest=ele
        lst.remove(smallest)
        lst1.append(smallest)
    return lst1


# person = ("M",30)
#people list = [("M",30),("F",23)]

def sort_age(lst):

    if len(lst) <= 1:
        return lst

    else:
        newlist = []
        biggest = lst[0]
        for i in lst[1:]:
            if biggest[1] > i[1]:
                continue
            else:
                biggest = i
                continue

        newlist += [biggest]

        lst.remove(biggest)

        return newlist + sort_age(lst)


def sort_age(lst):
    unsorted = lst
    sort = []
    while unsorted:
        oldest = unsorted[0]
        for i in unsorted[1:]:
            if i[1] > oldest[1]:
                oldest = i
        sort += [oldest,]
        unsorted.remove(oldest)
    return sort