Challenge: Default Arguments in Action
Oppgave
Swipe to start coding
Write a function rectangle_area that calculates the area of a rectangle, with the height defaulting to 1 if not provided.
- The function must take two parameters:
widthandheight, withheightdefaulting to 1. - The function must return the product of
widthandheight.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 6
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
Fantastisk!
Completion rate forbedret til 5.56
Challenge: Default Arguments in Action
Sveip for å vise menyen
Oppgave
Swipe to start coding
Write a function rectangle_area that calculates the area of a rectangle, with the height defaulting to 1 if not provided.
- The function must take two parameters:
widthandheight, withheightdefaulting to 1. - The function must return the product of
widthandheight.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 6
single