Python BasicsIntro
Boolean Logic
~7 mincode completion
Write is_valid_score(score) that returns when score is a number between 0 and 100 inclusive, and otherwise.
Examples
A score in the middle of the range is valid
- Input
- is_valid_score(50)
- Output
- True
0 is the bottom of the range and counts as valid
- Input
- is_valid_score(0)
- Output
- True
100 is the top of the range and counts as valid
- Input
- is_valid_score(100)
- Output
- True
Hints
Hint 1
Work directly with the arguments score and return the result rather than printing it.
Hint 2
Watch for this: used exclusive bounds.
Requirements
score: a numberReturn True if 0 <= score <= 100, otherwise False.
Constraints
Standard library only, no imports required
Time limit: 200 ms, Memory: 64 MB
Where this shows up
~7 min
••••••
3 employers weight this skill
2 frontier labs, 1 AI product company. Top match scores 80.
Python
def is_valid_score(score):
"""
Check whether a score is in the allowed range.
Args:
score: a number
Returns:
True if 0 <= score <= 100, otherwise False.
"""
# YOUR CODE HERE
pass