Challenge: Result Formatting Decorator
Task
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.
Solution
Everything was clear?
Thanks for your feedback!
Section 4. Chapter 4
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 5.88
Challenge: Result Formatting Decorator
Swipe to show menu
Task
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.
Solution
Everything was clear?
Thanks for your feedback!
Section 4. Chapter 4
single