Python Morsels Exercise

String-like class supporting case-insensitive comparisons

3 bonuses 9 hints 10 solutions 366 users solved 26 reviews

I'd like you to write a FuzzyString class which acts like a string, but does comparisons in a case-insensitive way.

For example:

>>> greeting = FuzzyString('Hey TREY!')
>>> greeting == 'hey Trey!'
>>> greeting == 'heyTrey'
>>> greeting
'Hey TREY!'

I'd like you to make sure equality and inequality match case-insensitively at first. I'd also like you to ensure that the string representations of your class match Python's string object's default string representations.

Bonus 1

This is just a preview of the problem statement.

This exercise includes 3 bonuses and 9 hint links.

To solve this exercise, sign in to your Python Morsels account.

A learning habit for experienced Pythonistas

Profile picture of Trey

My name is Trey Hunner and I hold Python trainings for teams. I've spent countless hours refining my most interesting Python exercises into Python Morsels, a Python skill-building platform for folks who already know Python. Python Morsels is design to help you deepen your Python skills every week.

Sign up for Python Morsels to access this exercise and many more.

Join Python Morsels ✨