Seksjon 4. Kapittel 1
single
Challenge: Argument Validation Decorator
Sveip for å vise menyen
Oppgave
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.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 4. Kapittel 1
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår