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

bookChallenge: Result Formatting Decorator

Tarea

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.

Solución

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 4. Capítulo 4
single

single

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

close

bookChallenge: Result Formatting Decorator

Desliza para mostrar el menú

Tarea

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.

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 4. Capítulo 4
single

single

some-alt