forked from werhereitacademy/Python_Modul_Week_2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeek2_HackerRank.py
More file actions
44 lines (40 loc) · 1.48 KB
/
Week2_HackerRank.py
File metadata and controls
44 lines (40 loc) · 1.48 KB
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
# https://www.hackerrank.com/challenges/list-comprehensions/problem
if __name__ == '__main__':
x = int(input())
y = int(input())
z = int(input())
n = int(input())
comprehensions_list = list()
for i in range(x+1):
for j in range(y+1):
for k in range(z+1):
if(i + j + k) != n :
comprehensions_list.append([i,j,k])
print(comprehensions_list)
"""---------------------------------------------------"""
# https://www.hackerrank.com/challenges/python-tuples/problem
if __name__ == '__main__':
n = int(input())
integer_list = map(int, input().split())
tuple_list= tuple(integer_list)
print(hash(tuple_list))
"""---------------------------------------------------"""
# https://www.hackerrank.com/challenges/nested-list/problem
if __name__ == '__main__':
students = list()
for _ in range(int(input())):
name = input()
score = float(input())
students.append((name, score))
students_sorted = sorted(students, key=lambda x: x[1])
min_score = students_sorted[0][1]
second_score = -1000
second_score_list = list()
for i in students_sorted:
if second_score < min_score < i[1] or min_score < i[1] == second_score:
second_score_list.append(i)
second_score = i[1]
if len(second_score_list) > 0:
second_score_list_sorted = sorted(second_score_list, key=lambda x: x[0])
for i in second_score_list_sorted:
print(i[0])