Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # UniqueTupleInList.py by gauravssnl
- # generates a list unique (a,b) pair for a range of number such that (b,a) does not appear in list & a != b
- n = range(1,5)
- L = [ (x,y) for x in n for y in n if x!= y ]
- S = [ ]
- for t in L :
- if tuple( set(t)) not in t :
- S.append(t)
- print S
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement