Skip to content

Commit 0db5d03

Browse files
authored
Merge pull request #18 from HighnessAtharva/patch-1
Updated code to work with Python3
2 parents 7c573ac + 300328e commit 0db5d03

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

Sets/SymmetricDifference.py

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,14 @@
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
66
Created : 15 July 2016
7+
Updated : 15 March 2021
78
Problem : https://www.hackerrank.com/challenges/symmetric-difference/problem
89
'''
9-
# Enter your code here. Read input from STDIN. Print output to STDOUT
10-
m=int(raw_input())
11-
set_a_str_ar=raw_input().strip().split()
12-
set_a_ar=list(map(int,set_a_str_ar))
13-
n=int(raw_input())
14-
set_b_str_ar=raw_input().strip().split()
15-
set_b_ar=list(map(int,set_b_str_ar))
16-
17-
set_a_set=set(set_a_ar)
18-
set_b_set=set(set_b_ar)
19-
set_a_dif_set=set_a_set.difference(set_b_set)
20-
set_b_dif_set=set_b_set.difference(set_a_set)
21-
res_set=set_a_dif_set.union(set_b_dif_set)
22-
res_ar=list(res_set)
23-
res_ar.sort()
24-
for i in res_ar:
25-
print i
10+
m = int(input())
11+
set_a = set(map(int, input().split()))
12+
n = int(input())
13+
set_b = set(map(int, input().split()))
14+
set_a_diff = set_a.difference(set_b)
15+
set_b_diff = set_b.difference(set_a)
16+
for i in sorted(set_a_diff.union(set_b_diff)):
17+
print(i)

0 commit comments

Comments
 (0)