Challenge: Result Formatting Decorator
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.
Рішення
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Can you explain this in simpler terms?
What are some examples related to this topic?
Where can I learn more about this?
Awesome!
Completion rate improved to 5.88
Challenge: Result Formatting Decorator
Свайпніть щоб показати меню
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.
Рішення
Дякуємо за ваш відгук!
single