-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathhackerrank.py
More file actions
54 lines (41 loc) · 1.04 KB
/
hackerrank.py
File metadata and controls
54 lines (41 loc) · 1.04 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
45
46
47
48
49
50
51
52
53
54
#Nestedlist
if __name__ == '__main__':
dic={}
s=list()
for _ in range(int(input())):
name = input()
score = float(input())
if score in dic:
dic[score].append(name)
else:
dic[score]=[name]
if score not in s:
s.append(score)
m=min(s)
s.remove(m)
m1=min(s)
dic[m1].sort()
for i in dic[m1]:
print(i)
#Tuples
if __name__ == '__main__':
n = int(input())
integer_list = map(int, input().split())
print(tuple(integer_list).__hash__())
# List Comprehensions
if __name__ == '__main__':
x = int(input())
y = int(input())
z = int(input())
n = int(input())
#Solution 1
# res=[]
# for i in range(x+1):
# for j in range(y+1):
# for k in range(z+1):
# if i+j+k !=n:
# res.append([i,j,k])
#print(res)
#Solution 2
res=[[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 ]
print(res)