-
Notifications
You must be signed in to change notification settings - Fork 943
/
Copy pathmain.py
86 lines (67 loc) · 1.98 KB
/
main.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import os
import numpy as np
command = input("Input command (A Name, Remove, Exit): ")
groupList = []
def printList(list):
for name in list:
print(name[0])
def printTrueList(list):
print("\nDEBUGGING ONLY:\n")
for name in list:
print(name)
def randomise(groupList):
lengthList = list(range(1, len(groupList) + 1))
groupNumberList = []
nameList = []
trueList = []
Toggle = True
for i in groupList:
groupNumberList.append(i[1])
nameList.append(i[0])
while Toggle:
np.random.shuffle(lengthList)
for i in range(len(groupNumberList)):
if groupNumberList[i] == lengthList[i]:
Toggle = True
break
else:
Toggle = False
for i in range(len(groupList)):
trueList.append((lengthList[i], groupNumberList[i]))
for i in trueList:
print(i[0], "-->", nameList[i[1] - 1])
def groupMaker(command):
while True:
if command.upper() == "EXIT":
os.system('clear')
print("All names:\n")
printList(groupList)
print("\n How the Assignment Works:")
print(
"The person holding the number is assigned \nthe person to the right of the arrow \n"
)
randomise(groupList)
break
elif command.upper() == "REMOVE":
print("")
for i, c in enumerate(groupList):
print(f'{i+1} {c[0]}')
choice = input("\nWho do you want to remove? (Insert Index Number): ")
groupList.pop(int(choice) - 1)
os.system('clear')
else:
number = input("\nWhat is your number?: ")
while True:
choice = input("Is your number correct? (Yes, No): ")
if choice.upper() == "YES":
break
elif choice.upper() == "NO":
number = input("\nWhat is your number?: ")
else:
pass
groupList.append((command.lower().capitalize(), int(number)))
os.system('clear')
print("Current people in the group")
printList(groupList)
command = input("Input command (a name, REMOVE, EXIT): ")
groupMaker(command)