Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. >>> unique([1, 2, 3])
  2. True
  3.  
  4. >>> unique([2, 4, 3, 4])
  5. False
  6.  
  7. def unique(lst):
  8. if len(lst) == 1:
  9. return True
  10. else:
  11. if lst[0] in lst[1:]:
  12. return False
  13. if lst[1] in unique(lst[2:-1]):
  14. return False
  15. else:
  16. return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement