id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

unique


Sometimes you use a list to represent a set of items, but you really want to have no duplicates, and just to make things neater, put the items in sorted order. Implement the function unique(items), which takes a list of items and returns a new list which has one copy of each of the items, in sorted order.


unique([1, 1, 2, 3]) → [1, 2, 3]
unique([1, 1, 1, 2, 2, 1]) → [1, 2]
unique([]) → []

...Save, Compile, Run (ctrl-enter)

def unique(items):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 99 Post-solution available

Copyright Nick Parlante 2017 - privacy