diff --git a/S2/TP2/tp2.py b/S2/TP2/tp2.py index ae49cc0..269f2fc 100644 --- a/S2/TP2/tp2.py +++ b/S2/TP2/tp2.py @@ -124,6 +124,7 @@ print('De par cet exemple, on remarque que chaine reste la même chaîne de cara question(4) def join(chaine, sequence): + # TODO Docstring res = '' l = len(sequence) for i in range(l): @@ -174,6 +175,15 @@ section('Une fonction sort pour les chaînes') question(1) +def sort(chaine): + # TODO Docstring + # TODO On peut pas faire plus court ? + l = list(chaine) + l.sort() + return ''.join(l) + +print('>>> sort(\'timoleon\')') +print(sort('timoleon')) partie('Anagrammes') # Jean-loup