< Back

Post Lab 12

Unique Elements

The previous assignment was a little more tougher than I had anticipated. This is partially because some skills when dealing with (and deciding to use) lists are a bit lacking. So today's post lab activity will be a coding activity involving lists.


In a file called compute_unique.py, write a function called get_unique_elements(a_list). This function takes a list of arbitrary elements as a parameter, and returns a list containing only the unique elements from a_list.

Sample Test Cases

Function Parameters Expected Output
["green", "red", "purple"] ["green", "red", "purple"]
["green", "red", "green"] ["green", "red"]
["green", "green", "green"] ["green"]

Submission

Goto http://inquire.roanoke.edu/ You should see a section for post labs. Submit your .py file to the appropriate post lab location.

Post labs are to be done individually. Sharing files between students is not allowed. Doing so is an Academic Integrity violation, and will be treated as such.