← Back to challenges

Return Sole Element in a Set

PythonMediumlanguage_fundamentalsobjects

Instructions

Given a set containing one element, return the element.

Examples

element_from_set({"innokodakademija"}) ➞ "innokodakademija"

element_from_set({True}) ➞ True

element_from_set({11037}) ➞ 11037

Notes

Lists, dictionaries, and other sets won't be elements because sets won't accept any mutable data types as elements.

python3
Loading editor…
⌘ ↵ to run
Walks through the solution with reasoning and edge cases.