Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def f(*a):
- a=list(a)
- h=set()
- while len(h)<10 and a:
- x=a.pop(0)
- if isinstance(x,list):
- a=x+a
- continue
- elif hasattr(x,'__hash__') and x.__hash__:
- h.add(x)
- else:
- raise Exception(f"Нехешируемый объект [{x}]")
- print(h)
- f(1,2,4)
- f([101,102,[103,104,[105,106],[107,107]],[[[[109]],[[110],[111]]]],7,8,5,4,2,4,3425,242342],2,3,4)
- f(1,[2]*1231,5,[2,2,[3],2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement