Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: Result Formatting Decorator | Decorator Practice Lab
Python Decorators Explained

bookChallenge: Result Formatting Decorator

Tarefa

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.

Solução

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 4. Capítulo 4
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

close

bookChallenge: Result Formatting Decorator

Deslize para mostrar o menu

Tarefa

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.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 4. Capítulo 4
single

single

some-alt