forked from fenyx-it-academy/Class5-Python-Module-Week2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhackerrank.py
More file actions
32 lines (29 loc) · 775 Bytes
/
hackerrank.py
File metadata and controls
32 lines (29 loc) · 775 Bytes
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
# List Comprehensions
if __name__ == '__main__':
x = int(input())
y = int(input())
z = int(input())
n = int(input())
print(list([[i,i2,i3]for i in range(x+1) for i2 in range(y+1) for i3 in range(z+1) if i+i2+i3!=n]))
# Tuples
if __name__ == '__main__':
n = int(input())
integer_list = map(int, input().split())
t = tuple(integer_list)
print(hash(t))
# t=(1,2)
# print(hash(t))
#Nested Lists
if __name__ == '__main__':
list1=[]
for _ in range(int(input())):
name = input()
score = float(input())
list1.append([name,score])
a= sorted(list({k for i,k in list1}))[1]
list2=[]
for i,x in list1:
if x==a:
list2.append(i)
list2.sort()
print(*[i for i in list2],sep="\n")