-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheau14.py
38 lines (28 loc) · 814 Bytes
/
eau14.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import sys
# Fonctions utilisées:
def ascii_sort(arguments):
for i in range(len(arguments)):
min = i
for j in range(i+1, len(arguments)):
if arguments[j] < arguments[min]:
min = j
arguments[i], arguments[min] = arguments[min], arguments[i]
return " ".join(arguments)
# Gestion d'erreurs :
def is_valid_length(arguments):
if len(arguments) < 2:
print("Erreur : Merci d'indiquer au moins deux arguments")
return False
return True
# Récupération de données :
def get_arguments():
arguments = sys.argv[1:]
return arguments
# Résolution :
def display():
arguments = get_arguments()
if not is_valid_length(arguments):
return
print(ascii_sort(arguments))
# Affichage :
display()