kAldown

Untitled

May 27th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. def checkio(a):
  2.     #Your code here
  3.     #It's main function. Don't remove this function
  4.     #It's used for auto-testing and must return a result for check.  
  5.     source = set(a)
  6.     source = dict.fromkeys(set(a), 0)
  7.    
  8.    
  9.     for x, v in source.items():
  10.         for y in a:
  11.             if v >= 2:
  12.                 break
  13.             if x == y:
  14.                 source[y] += 1
  15.     for k, v in source.items():
  16.         if v == 1:
  17.             a.remove(k)
  18.  
  19.     #replace this for solution
  20.     return a
Advertisement
Add Comment
Please, Sign In to add comment