Skip to content

Commit 3d27b61

Browse files
Nested Lists and second lowest
1 parent bbab0d1 commit 3d27b61

2 files changed

Lines changed: 82 additions & 37 deletions

File tree

.idea/workspace.xml

Lines changed: 57 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pythonNestedLists.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
lst = list()
2+
uniqueListOfScores = list()
3+
tempListOfScores = list()
4+
pos = None
5+
studentCount = int(raw_input())
6+
lowest = None
7+
for x in range(0,studentCount):
8+
lst.append([raw_input(), float(raw_input())])
9+
#print lst
10+
#print lst[0][1], lst[1][1], lst[2][1], lst[3][1], lst[4][1]
11+
12+
tempListOfScores = [lst[x][1] for x in range(0, studentCount)]
13+
uniqueListOfScores = list(set(tempListOfScores))
14+
minimumOfAll = min(uniqueListOfScores)
15+
uniqueListOfScores.remove(minimumOfAll)
16+
#print uniqueListOfScores
17+
secondMinimumOfAll = min(uniqueListOfScores)
18+
lst = [x[0] for x in lst if x[1] == secondMinimumOfAll]
19+
#print lst
20+
lst.sort()
21+
if len(lst) > 1:
22+
print lst[0]
23+
print lst[1]
24+
else:
25+
print lst[0]

0 commit comments

Comments
 (0)