Challenge: Result Formatting Decorator
Taak
Swipe to start coding
In this task, you will develop a decorator that modifies the result of a function. The decorator must convert the result to uppercase if the result is a string. If the result is not a string, it should be returned unchanged.
- The decorator must check if the result is a string.
- If the result is a string, it must return the uppercase version of the result.
- If the result is not a string, it must return the result without modification.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 4. Hoofdstuk 4
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Awesome!
Completion rate improved to 5.88
Challenge: Result Formatting Decorator
Veeg om het menu te tonen
Taak
Swipe to start coding
In this task, you will develop a decorator that modifies the result of a function. The decorator must convert the result to uppercase if the result is a string. If the result is not a string, it should be returned unchanged.
- The decorator must check if the result is a string.
- If the result is a string, it must return the uppercase version of the result.
- If the result is not a string, it must return the result without modification.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 4. Hoofdstuk 4
single