From a6c0bb492c9a6eca89864ab8cc4ce05bfeb3080b Mon Sep 17 00:00:00 2001 From: Serzh470 Date: Sun, 3 Sep 2017 20:38:50 +0300 Subject: [PATCH] Update 22_list_only_doubles.py --- 22_list_only_doubles.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/22_list_only_doubles.py b/22_list_only_doubles.py index 1fc3b7b..36df2df 100644 --- a/22_list_only_doubles.py +++ b/22_list_only_doubles.py @@ -8,19 +8,15 @@ может быть произвольным # put your python code here -s = [ int(i) for i in input().split()] -t = [] -s.sort() -l = len(s)-1 -k = 100000 -if len(s)!=1: - for i in range(0,l): - if s[i]==s[i+1] and s[i]!=k: - t.append(s[i]) - k=s[i] - for j in range(l,l+1): - if s[-1]==s[-2] and s[j]!=k: - t.append(s[j]) -n = len(t) -for g in range(0,n): - print(t[g],end=' ') +s=[int(i) for i in input().split()] +i, j = 0, 0 +j=0 +n=[] +for st in s: + if i!=s.index(st) and st not in n: + n.append(st) + i+=1 +n.sort() +for st2 in n: + print (str(n[j])+' ', end='') + j+=1