-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNested List.py
63 lines (40 loc) · 1.52 KB
/
Nested List.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
def getIndexList(listIndex,valueIndex):
for x,y in enumerate(listIndex):
if y == listIndex[valueIndex]:
return x
def minValueArray(nameList, scoreList):
global valueInf
for x in range(len(nameList)):
minScore = scoreList.index(min(scoreList))
if valueInf != scoreList[minScore] and x != 0:
break;
valueInf = scoreList[minScore]
listMin.append(nameList[minScore])
scoreList.remove(scoreList[minScore])
del nameList[minScore]
for y in sorted(listMin):
print(y)
return True
if __name__ == '__main__':
nameList = []
scoreList = []
listMin = []
valueInf = 0
n = int(input())
for _ in range(n):
name = input()
score = float(input())
nameList.append(name)
scoreList.append(score)
while True:
if n == len(scoreList):
while True:
oldValue = scoreList[scoreList.index(min(scoreList))]
indexValue = getIndexList(scoreList, scoreList.index(min(scoreList)))
scoreList.remove(scoreList[scoreList.index(min(scoreList))])
del nameList[indexValue]
if oldValue != scoreList[scoreList.index(min(scoreList))]:
break
else:
if minValueArray(nameList, scoreList) == True:
break