Challenge: Mixed Logic and Range
Swipe to start coding
Fix the logic, comparison, and range errors in the function so it works as intended:
- For each number in the
numberslist, check if it is between 10 and 20, inclusive. - If a number is in this range, label it as
"in range"; otherwise, label it as"out of range". - Return a list of tuples, each containing the original number and its label.
Example output for the call filter_and_label([9, 10, 15, 20, 21]) should be:
[(9, 'out of range'), (10, 'in range'), (15, 'in range'), (20, 'in range'), (21, 'out of range')]
Løsning
Takk for tilbakemeldingene dine!
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
Can you explain this in simpler terms?
What are some examples related to this topic?
Where can I learn more about this?
Awesome!
Completion rate improved to 5.26
Challenge: Mixed Logic and Range
Sveip for å vise menyen
Swipe to start coding
Fix the logic, comparison, and range errors in the function so it works as intended:
- For each number in the
numberslist, check if it is between 10 and 20, inclusive. - If a number is in this range, label it as
"in range"; otherwise, label it as"out of range". - Return a list of tuples, each containing the original number and its label.
Example output for the call filter_and_label([9, 10, 15, 20, 21]) should be:
[(9, 'out of range'), (10, 'in range'), (15, 'in range'), (20, 'in range'), (21, 'out of range')]
Løsning
Takk for tilbakemeldingene dine!
single