Menu
Coddy logo textTech

Recap - Elements Of Freedom

Part of the Logic & Flow section of Coddy's Python journey — lesson 55 of 78.

challenge icon

Challenge

Easy

Create a function named elements_of_freedom that processes a list of string elements according to specific rules.

Your function should:

  1. Filter out elements that have fewer than 5 characters
  2. Convert the remaining elements to uppercase
  3. Remove any duplicate elements
  4. Return a list of the unique uppercase elements

Use list operations to efficiently process the data.

Note: Preserve the original order of elements in the list.

Example:

Input: ["apple", "banana", "cherry", "date", "apple", "banana", "grape", "fig"]
Output: ['APPLE', 'BANANA', 'CHERRY', 'GRAPE']

Try it yourself

def elements_of_freedom(elements):
    # Your solution here
    
    # Step 1: Filter elements with length >= 5
    
    # Step 2: Convert filtered elements to uppercase
    
    # Step 3: Create a list of unique elements
    
    # Step 4: Return the final result
    pass

All lessons in Logic & Flow