HELP! Jason can't find his textbook! It is two days before the test date, and Jason's textbooks are all out of order! Help him sort a list (ArrayList in java) full of textbooks by subject, so he can study before the test.

The sorting should **NOT** be case sensitive

Difficulty: introductory

Starter code:

def sorter(textbooks):
	

Solutions:
def sorter(textbooks):
    return sorted(textbooks,key=str.lower)

def sorter(textbooks):
    return sorted(textbooks, key=str.casefold)

def sorter(textbooks):
    return sorted(textbooks, key = lambda arg: arg.lower())

sorter = lambda x: sorted(x,key=lambda s:s.lower())

sorter = lambda text: sorted(text, key=lambda s: s.lower())

def sorter(lst):
    return sorted(lst, key=lambda e: e.lower())

def sorter(textbooks):
    return sorted(textbooks, key=lambda text: text.lower())

def sorter(textbooks):
    def f(e):
       return e.lower()
    sorted = textbooks.sort(key=f)
    return textbooks

def sorter(textbooks):
    d = {t.lower(): t for t in textbooks}
    return [d[t] for t in sorted(d)]

def sorter(textbooks):
  arr=sorted(textbooks,key=str.lower)
  return arr

sorter = lambda textbooks: sorted(textbooks, key=str.lower)

from typing import List

def sorter(textbooks: List[str]):
    """ Sort textbooks by subjects. """
    return sorted(textbooks, key=str.lower)

def sorter(textbooks):
    textbooks.sort(key = lambda x: x.lower())
    # .sort() sorts the list while considering every element as if it is in lowercase
    return textbooks

def myf(a):
    return a.lower()
    
def sorter(textbooks):
    return sorted(textbooks, key=myf)

def sorter(textbooks):
    ##use list.sort(), and instruct programme to ignore capitalisation
    textbooks.sort(key = str.lower)
    return(textbooks)

def sorter(textbooks):
  my_sort = sorted(textbooks, key=str.lower)
  return my_sort

def sorter(textbooks: list) -> list:
    return sorted(textbooks, key=str.casefold)

def sorter(textbooks):
    textbooks.sort()
    return sorted(textbooks, key =lambda x: x.lower())#Cramming before a test can't be that bad?

def sorter(textbooks):
    listtemp = [(x.lower(),x) for x in textbooks]
    listtemp.sort()
    return [x[1] for x in listtemp]

def sorter(textbooks):
    r = {i.lower():i for i in textbooks}
    return [r[i] for i in sorted(r)]

def sorter(textbooks):
    subjects = dict((sub.lower(), sub) for sub in textbooks)
    return [subjects[sub] for sub in sorted(subjects.keys())]

sorter = lambda textbooks: list(sorted(textbooks, key = lambda s: s.lower()))

def sorter(textbooks):
    '''Function that sort a list full of textbooks by subject'''
    return sorted(textbooks,key=str.lower)

def sorter(textbooks):
    k = sorted(textbooks, key=str.casefold)
    return k

sorter = lambda textbooks:sorted(textbooks, key=str.casefold)

'''make a case insensitive sorted list'''

def sorter(textbooks):
    return list(sorted(textbooks, key=lambda e: e.lower()))


import functools;

def cmp(a, b):
    aa = a.lower()
    bb = b.lower()
    
    if aa > bb:
        return 1
    elif bb > aa:
        return -1
    else:
        return 0

def sorter(textbooks):
   return sorted(textbooks, key=functools.cmp_to_key(cmp))

from typing import List

def sorter(textbooks: List[str]) -> List[str]:
    """Returns the textbooks non-case-sensitive sorted."""
    return sorted(textbooks, key=str.casefold)

from typing import List

def sorter(textbooks: List[str]) -> List[str]:
    """Returns the textbooks list non-case-sensitive sorted."""
    return sorted(textbooks, key=str.lower)

def sorter(tks):
    return sorted(tks, key=lambda s: s.lower())

def sorter(textbooks):
    return sorted(textbooks, key=lambda v: (v.casefold(), v))

def get_first(element):
    return element[0]

def sorter(textbooks):
    lst = [(el.lower(), el) for el in textbooks]
    lst1 = sorted(lst,key=get_first)
    return [el[1] for el in lst1]

def sorter(textbooks):
    lst = sorted([(el.lower(), el) for el in textbooks])
    return [el[1] for el in lst]

def sorter(textbooks):
    #Cramming before a test can't be that bad?
    def f(x):
        return x.lower()
    return sorted(textbooks,key=f)

def sorter(textbooks):
    return list(sorted(textbooks, key=str.casefold))

def sorter(textbooks):
    """
    Sort list of textbooks
    """
    return sorted(textbooks, key = str.lower)

def sorter(textbooks):
    t2=sorted(textbooks,key=str.lower)
    return t2

def sorter(textbooks):
    textbooks = sorted(textbooks, key = str.casefold)
    return textbooks

def sorter(textbooks):
    #Cramming before a test can't be that bad?
    bookList = sorted(textbooks, key=str.lower)
    return bookList

def sorter(textbooks):
    return sorted(sorted(textbooks, key = lambda x: x[1].lower()), key = lambda x: x[0].lower())

def sorter(textbooks):
    x = sorted(textbooks, key = lambda s: s.casefold())
    return x

def sorter(textbooks):
    return sorted(set(textbooks),key=str.casefold)

def sorter(textbooks):
    result = []
    books_lowcase = [x.lower() for x in textbooks]
    books_dict = dict(zip(books_lowcase, textbooks))
    dict_keys_sort = list(books_dict.keys())
    dict_keys_sort.sort()
    for i in dict_keys_sort:
        result.append(books_dict[i])
    return result

import re
def sorter(textbooks):
    textbooks.sort(key=str.lower) 
    return textbooks
    #Cramming before a test can't be that bad?
    #print(re.findall(r"\S",textbooks,re.IGNORECASE))
    #return sorted(textbooks)


def sorter(textbooks):

    s = sorted(textbooks)
    
    if textbooks == s:
        
        return textbooks
        
    if s == s.sort(key=str.lower):
    
        return s.sort(key=str.lower)
        
    else:
    
        return s
        
        
    


def lower_case(predmet):
    return predmet.lower()
def sorter(textbooks):
    return sorted(textbooks, key = lower_case)

def register(textbook):
    return textbook.lower()

def sorter(textbooks):
    textbooks.sort(key=register)
    return textbooks

def sorter(textbooks):
    return sorted(textbooks, key=lambda s: s.lower())
    #orted(unsorted_list, key=lambda s: s.lower())
    #Cramming before a test can't be that bad?


def sorter(*textbooks):
    for textbook in textbooks:
        print(textbook.sort(key=str.lower))
    return textbook

def sorter(textbooks):
    textbooks.sort(key=str.lower)
    return textbooks
    
#   return sorted(textbooks,key=str.lower)


def f(x):
    x = x.lower()
    return x

def sorter(textbooks):
    textbooks.sort(key = f)
    return textbooks

def sorter(textbooks):
    textbooks = sorted(textbooks, key=lambda x:x[0:] if x[0:].islower() else x[0:].lower())
    return textbooks

def sorter(textbooks):
    return(sorted([i for i in textbooks], key = lambda str: str.lower()))

def sorter(textbooks: list):
    return sorted(textbooks, key=str.lower)

def sorter(t):
    t.sort(key=str.casefold)
    return t

import locale

def sorter(textbooks):
    textbooks.sort(key=lambda x: x.lower())
    return textbooks

sorter=lambda s:sorted(s,key=lambda x:x.lower())

def sorter(t):
    return sorted(t,key=lambda t:t.casefold())


def sorter(textbooks):
    return sorted(textbooks, key = lambda x: x[0:2].lower())
    #Cramming before a test can't be that bad?


def sorter(textbooks):
    lst_books = []
    for i in textbooks:
            lst_books.append(i)
    return sorted(lst_books, key=str.lower)

def sorter(textbooks):
    textbooks_low = [el.lower() for el in textbooks]
    
    textbooks_low_sorted = sorted(textbooks_low)
  
    testbooks_sorted_indexes = [textbooks_low.index(el) for el in textbooks_low_sorted]
    
    return [ textbooks[ind] for ind in testbooks_sorted_indexes ]

def sorter(textbooks):
    if textbooks!=int:
        return sorted(textbooks,key=str.lower)

def sorter(text_books):
    return sorted(text_books, key = str.lower)

def sorter(textbooks):
  list.sort(textbooks, key = str.lower)
  return textbooks

def sorter(textbooks):
    return sorted(textbooks, key=lambda t: (t.lower(), t))


def sorter(textbooks):
    arr = []
    for i, book in enumerate(textbooks):
        arr.append([book.lower(), i])
    arr = sorted(arr)
    for i, book in enumerate(arr):
        arr[i] = textbooks[book[1]]
    return arr

def sorter(textbooks):
    a = sorted(textbooks, key = str.lower)
    return a

sorter = lambda books: sorted(books, key = lambda _: _.lower())

import string

def sorter(textbooks):
    return sorted(textbooks,key=str.lower)

sorter=lambda t: sorted(t, key=lambda s: s.lower())

def sorter(textbooks):
    a = sorted(textbooks, key=str.casefold)
    print(textbooks, a) 
    return a#Cramming before a test can't be that bad?

def sorter(textbooks):
    result = sorted(textbooks, key=str.lower)
    return result

def sorter(textbooks):
    #Cramming before a test can't be that bad?
#     return sorted(textbooks, key=cmp_to_key(locale.strcoll))
    textbooks.sort(key=str.lower)
    return textbooks 

def sorter(textbooks):
    sorted_books=sorted(textbooks,key=str.casefold)
    
    return sorted_books

# Sort the $%&*!#$! textbooks
def sorter(textbooks):
    obj = {}
    lower_case_textbooks = []
    for textbook in textbooks:
        lower_case_textbook = textbook.lower()
        obj[lower_case_textbook] = textbook
        lower_case_textbooks.append(lower_case_textbook)
    sorted_textbooks = sorted(lower_case_textbooks)
    output_list = [];
    for sorted_textbook in sorted_textbooks:
        output_list.append(obj[sorted_textbook])
    return output_list

def sorter(textbooks):
    print(textbooks)
    print(sorted(textbooks,key=str.lower))
    return sorted(textbooks,key=str.lower)

def sorter(textbooks):
    return sorted(textbooks, key=lambda e: e.lower())

def sorter(textbooks):
    print(sorted(textbooks))
    return sorted(textbooks, key = lambda x: x.lower())

def sorter(textbooks):
    #Cramming before a test can't be that bad?
    ts = sorted(textbooks, key=str.lower)
    return ts

def sorter(arr):
    for i in range(len(arr) - 1):
        for j in range(len(arr) - i - 1):
            if arr[j].lower() > arr[j+1].lower():
                arr[j], arr[j+1] = arr[j+1], arr[j]
    return arr

def sorter(textbooks):
    return [a[1] for a in sorted([(b.lower(), b) for b in textbooks])]

def sorter(t):
    return sorted(t,key=str.casefold)

def sorter(tb):
    return sorted(tb, key=lambda x: x.lower())

def sorter(textbooks):
    sorted = [book.lower() for book in textbooks]
    sorted.sort()
    final = textbooks.copy()
    for book in textbooks:
        final[sorted.index(book.lower())] = book
    return final

def sorter(textbooks):
    copy = [text.lower() for text in textbooks]
    final = []
    to_sort = list(copy)
    to_sort.sort()
    for t in to_sort:
        final.append(textbooks[copy.index(t)])
    return final

sorter = lambda x: sorted(x, key=str.casefold)

def sorter(textbooks):
    #Cramming before a test can't be that bad
    a=[i.lower() for i in textbooks]
    s=sorted(a)
    
    for i in range(len(s)):
        if s[i] in textbooks:
            pass
        else:
            s[i]=textbooks[a.index(s[i])]
    return s

def sorter(textbooks):
    return sorted(textbooks, key=lambda w:w.casefold())

def sorter(textbooks):
    ret=[t for t in textbooks]
    ret.sort(key=lambda x: x.lower())
    return ret

import numpy as np

def sorter(textbooks):
    return sorted(textbooks,key=str.lower)


import functools

def compares(item1, item2):
    if len(item1) == 0:
        return -1
    if len(item2) == 0:
        return 1
    if ord(item1[0].lower()) < ord(item2[0].lower()):
        return -1
    elif ord(item1[0].lower()) > ord(item2[0].lower()):
        return 1
    else:
        return compares(item1[1:], item2[1:])

def compare(item1, item2):
    return compares(item1,item2)
def sorter(textbooks):
    #Cramming before a test can't be that bad?
    return sorted(textbooks, key=functools.cmp_to_key(compare))


def sorter(t):
    a = sorted(t, key=str.lower)
    return a 

class Book():
    def __init__(self, subject):
        self.subject = subject
    def __lt__(self, other):
        return self.subject.lower() < other.subject.lower()

def sorter(textbooks):
    a = [Book(subj) for subj in textbooks]
    a.sort()
    output = [i.subject for i in a]
    return output

def sorter(textbooks):
    return sorted(textbooks, key=lambda v: v.lower())

def sorter(textbooks):
    sortbooks = sorted([x.lower() for x in textbooks])
    out = []
    for sb in sortbooks:
        for tb in textbooks:
            if sb==tb.lower():
                out.append(tb)
    return out

def sorter(textbooks):
    index = {word.lower():word for word in textbooks}
    keys = sorted(index.keys())
    return [index[key] for key in keys]

def sorter(textbooks):
    #Cramming before a test can't be that bad?
    return sorted([textbook for textbook in textbooks], key=lambda x: x.lower())

def sorter(textbooks):
    
    sorted_list = sorted(textbooks, key=str.lower)
    return sorted_list

sorter = lambda textbooks: sorted(textbooks, key = lambda t: t.lower())