forked from sancty007/ExercicesPython
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFormationEquipe.py
69 lines (34 loc) · 1.14 KB
/
FormationEquipe.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import random
# studen list / list pair
names = ["Alice", "Bob", "Charlie", "David", "Eve", "Frank", "Grace", "Hannah"]
"""
randomList : perme de melanger une liste et
retourne une nouvelle liste
"""
def randomList(myList) -> list:
try :
return random.sample(myList,len(myList)) # return new list
except :
print("Un probleme dans le code..! Veuillez donner une liste en paramètre")
"""
halfList : retourne -> la longueur de la moitier de la liste
"""
def halfList(newList)-> int:
return len(newList)//2#cut length of the list in half
"""
printeTwoLists :permet retourner -> deux listes grace au tuples
"""
def printeTwoLists(newList) -> tuple:
half = halfList(newList)
firstList =[i for i in newList[:half]]
secondtList =[i for i in newList[half:]]
return (firstList , secondtList) # -> return tuple
newList =randomList(names)
firstList,secondtList =printeTwoLists(newList)
print(firstList)
print("----------------------------------")
print(secondtList)
"""
for element, element2 in zip(nouvelleListe ,noms) :
print(f"{element}{element2}")
"""