Seksjon 4. Kapittel 4
single
Challenge: Conditional Decorator
Sveip for å vise menyen
Oppgave
Sveip for å begynne å kode
Write a parameterized decorator that only allows a function to run if a given argument is True.
- If the parameter to the decorator is
True, call the decorated function and return its result. - If the parameter to the decorator is
False, do not call the decorated function andreturn Noneinstead. - Do not forget to return
decoratorandwrapperfunctions.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 4. Kapittel 4
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