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

bookChallenge: Argument Validation Decorator

Tarefa

Swipe to start coding

Create a decorator named positive_integer_args that checks all arguments passed to a function. The decorator must ensure every argument (both positional and keyword) is a positive integer. If any argument is not a positive integer, the decorator should raise a ValueError. Only if all arguments are valid should the original function execute.

Solução

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 4. Capítulo 1
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

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

Suggested prompts:

Can you explain this in simpler terms?

What are the main takeaways from this?

Can you give me an example?

close

bookChallenge: Argument Validation Decorator

Deslize para mostrar o menu

Tarefa

Swipe to start coding

Create a decorator named positive_integer_args that checks all arguments passed to a function. The decorator must ensure every argument (both positional and keyword) is a positive integer. If any argument is not a positive integer, the decorator should raise a ValueError. Only if all arguments are valid should the original function execute.

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 1
single

single

some-alt