Skip to content
Snippets Groups Projects
Select Git revision
1 result Searching

test_heap.py

Blame
  • Forked from Vuillemot Romain / INF-TC1
    Source project has a limited visibility.
    tri-stabilite.py 344 B
    def algo(words):
        t = []
        for word in words:
           t.append((len(word), word))
    
        t.sort(key=lambda t: t[1][-1])
    
        res = []
        for l, w in t:
            res.append(w)
    
        res = filter(lambda t: 'a' in t, res) 
    
        return list(res)
    
    if __name__=="__main__": 
        print(algo(["Pierre", "Jean", "Marie", "Eric", "Nathalie", "Yvonne"]))