← Back to challenges

Magic Sigil Generator

PythonHardstringsloopsformattingregex

Instructions

A magic sigil is a glyph which represents a desire one wishes to manifest in their lives. There are many ways to create a sigil, but the most common is to write out a specific desire (e.g. "I HAVE WONDERFUL FRIENDS WHO LOVE ME"), remove all vowels, remove any duplicate letters (keeping the last occurence), and then design a glyph from what remains.

Using the sentence above as an example, we would remove duplicate letters:

AUFRINDSWHLOVME

And then remove all vowels, leaving us with:

FRNDSWHLVM

Create a function that takes a string and removes its vowels and duplicate letters. The returned string should not contain any spaces and be in uppercase.

Examples

sigilize("i am healthy") ➞ "MLTHY"

sigilize("I FOUND MY SOULMATE") ➞ "FNDYSLMT"

sigilize("I have a job I enjoy and it pays well") ➞ "HVBJNDTPYSWL"

Notes

  • For duplicate letters the last one is kept.
  • When performing actual sigil magic, you must make your sigils manually.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.