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

bookChallenge: Result Formatting Decorator

Compito

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.

Soluzione

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 4
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

Suggested prompts:

Can you explain this in simpler terms?

What are some examples related to this topic?

Where can I learn more about this?

close

bookChallenge: Result Formatting Decorator

Scorri per mostrare il menu

Compito

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.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 4
single

single

some-alt