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
29 lines (27 loc) · 779 Bytes
/
hackerrank.py
File metadata and controls
29 lines (27 loc) · 779 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
#list comprehension
if __name__ == '__main__':
x = int(input())
y = int(input())
z = int(input())
n = int(input())
print(list([[i,j,k] for i in range(x + 1) for j in range(y+1) for k in range (z+1) if i+ j+ k!= n]) )
#tuples
if __name__ == '__main__':
n = int(input())
integer_list = map(int, input().split())
t = tuple(integer_list)
print(hash(t))
#nested list
if __name__ == '__main__':
list_1=[]
for _ in range(int(input())):
name = input()
score = float(input())
list_1.append([name,score])
a= sorted(list({k for i,k in list_1}))[1]
list_2=[]
for i,x in list_1:
if x==a:
list_2.append(i)
list_2.sort()
print(*[i for i in list_2],sep="\n")