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

bookChallenge: Result Formatting Decorator

Taak

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.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 4. Hoofdstuk 4
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

close

bookChallenge: Result Formatting Decorator

Veeg om het menu te tonen

Taak

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.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 4. Hoofdstuk 4
single

single

some-alt