-
Notifications
You must be signed in to change notification settings - Fork 20
/
Duplicated Products
69 lines (46 loc) · 1.18 KB
/
Duplicated Products
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'numDuplicates' function below.
#
# The function is expected to return an INTEGER.
# The function accepts following parameters:
# 1. STRING_ARRAY name
# 2. INTEGER_ARRAY price
# 3. INTEGER_ARRAY weight
#
def numDuplicates(name, price, weight):
# Write your code here
q=[]
counter=0
for a,b,c in zip(name,price,weight):
x=(a,b,c)
q.append(x)
l=len(q)
w=set(q)
e=len(w)
return (l-e)
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
name_count = int(input().strip())
name = []
for _ in range(name_count):
name_item = input()
name.append(name_item)
price_count = int(input().strip())
price = []
for _ in range(price_count):
price_item = int(input().strip())
price.append(price_item)
weight_count = int(input().strip())
weight = []
for _ in range(weight_count):
weight_item = int(input().strip())
weight.append(weight_item)
result = numDuplicates(name, price, weight)
fptr.write(str(result) + '\n')
fptr.close()