Registry Synced

Jan 2026 - Python - Week 6 - Collections 4 - Graded

586 words
3 min read

Collections 4 - Graded

Course: Jan 2026 - Python
Collections 4 - Graded
Submission deadline has passed for this assignment
Due Mar 25, 2026 at 11:59 PM IST
Instructions
Use "Test Run" to verify your code with public test cases.
Press "Submit" to have your assignment evaluated.
You can submit your assignment multiple times up until the deadline.
Make sure to submit your final code by the deadline to receive your score.
Summary
100 out of100
Score
Public Tests
3/3 Passed
Submitted on Mar 25, 2026 at 2:34 PM IST
Private Tests
3/3 Passed
Submitted on Mar 25, 2026 at 2:34 PM IST

**Change in eligibility criteria to write oppe2 exam: A5>=40/100 AND A6>=40/100 AND A7>=40/100 AND A8>=40/100. and becoming eligible to give the end term exam.


Set of Unique vowels in a string.**
Given a string, return a set of unique vowels present in the string.
Examples
>>> unique_vowels('banana treat')
{'a', 'e'}
>>> unique_vowels('apple lolipop')
{'a', 'e', 'i', 'o'}
Template Code(Click to Expand)

def unique_vowels(s: str) -> set:
    '''
    Given a string, return a set of unique vowels present in the string.

    Arguments:
    s: str - the input string

    Return:
    set - a set of unique vowels present in the string

    Examples:
    >>> unique_vowels('banana treat')
    {'a', 'e'}
    >>> unique_vowels('apple lolipop')
    {'a', 'e', 'i', 'o'}
    >>> unique_vowels('Ian Avinkov')
    {'I','A','a','i','o'}
    '''
    ...

NOTE: You can use the below tools for working out and debugging. Click to open them in new tab.

Public Tests ( 3/3 )

Case 1

Input:
text
is_equal(
    unique_vowels('aeiouApple aeiouOrange'),
    {'A','O','a','e','i', 'o','u'}
)
Expected Output:
text
{'A', 'O', 'a', 'e', 'i', 'o', 'u'}
Actual Output:
text
{'A', 'O', 'a', 'e', 'i', 'o', 'u'}

Case 2

Input:
text
is_equal(
    unique_vowels("how's the josh!!!"),
    {'e', 'o'}
)
Expected Output:
text
{'e', 'o'}
Actual Output:
text
{'e', 'o'}

Case 3

Input:
text
is_equal(
    unique_vowels('Ian Avinkov'),
    {'I','A','a','i','o'}
)
Expected Output:
text
{'A', 'I', 'a', 'i', 'o'}
Actual Output:
text
{'A', 'I', 'a', 'i', 'o'}

Private Tests ( 3/3 )

Case 1

Input:
text
is_equal(unique_vowels('pyth0n'), set())
Expected Output:
text
{}
Actual Output:
text
{}

Case 2

Input:
text
is_equal(unique_vowels("HOPE yOu are DOinG Well!!"), {'E', 'u', 'i', 'O', 'e', 'a'})
Expected Output:
text
{'E', 'O', 'a', 'e', 'i', 'u'}
Actual Output:
text
{'E', 'O', 'a', 'e', 'i', 'u'}

Case 3

Input:
text
is_equal(unique_vowels("Watermelon Ice Cream"), {'I','a','e','o'})
Expected Output:
text
{'I', 'a', 'e', 'o'}
Actual Output:
text
{'I', 'a', 'e', 'o'}

💻 IITM Official Solution

python

def unique_vowels(s: str) -> set:
    '''
    Given a string, return a set of unique vowels present in the string.

    Arguments:
    s: str - the input string

    Return:
    set - a set of unique vowels present in the string

    Examples:
    >>> unique_vowels('banana treat')
    {'a', 'e'}
    >>> unique_vowels('apple lolipop')
    {'a', 'e', 'i', 'o'}
    >>> unique_vowels('Ian Avinkov')
    {'I','A','a','i','o'}
    '''

    return set(s) & set("aeiou"+"aeiou".upper())


💻 My Submitted Code

python

def unique_vowels(s: str) -> set:
    '''
    Given a string, return a set of unique vowels present in the string.

    Arguments:
    s: str - the input string

    Return:
    set - a set of unique vowels present in the string

    Examples:
    >>> unique_vowels('banana treat')
    {'a', 'e'}
    >>> unique_vowels('apple lolipop')
    {'a', 'e', 'i', 'o'}
    >>> unique_vowels('Ian Avinkov')
    {'I','A','a','i','o'}
    '''
    ...
    vowels = "aeiouAEIOU"
    return {char for char in s if char in vowels}

Document Outline
Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.