Complete the code to define an equivalence partition for ages between 18 and 60.
def is_valid_age(age): return [1]
The correct equivalence partition for valid ages includes all ages from 18 to 60 inclusive, so the condition 18 <= age <= 60 correctly checks this range.
Complete the code to test the lower boundary value for a password length of at least 8 characters.
def is_valid_password(password): return len(password) [1] 8
The password length should be at least 8 characters, so the correct operator is >= to include passwords with length exactly 8.
Fix the error in the boundary value check for input between 1 and 100 inclusive.
def is_in_range(value): return value [1] 1 and value [2] 100
To check if a value is between 1 and 100 inclusive, use >= 1 and <= 100. This includes the boundary values 1 and 100.
Fill both blanks to create a test condition that partitions input into valid and invalid age groups using equivalence partitioning.
def age_group(age): if age [1] 17: return 'invalid' elif age [2] 18: return 'valid'
To separate invalid ages as 17 or less, use <= 17. To mark valid ages as 18 or more, use >= 18.
Fill all three blanks to create a dictionary comprehension that maps test inputs to their validity using boundary value analysis.
test_results = {input_value: (input_value [1] 0 and input_value [2] 100) for input_value in [[3]]}The dictionary comprehension checks if each input_value is between 0 and 100 inclusive using >= 0 and <= 100. The test inputs include 50, 0, and 100 to cover boundary and typical values.