Complete the code to define an equivalence partition for ages 18 to 65.
def is_valid_age(age): return [1]
The correct equivalence partition for valid ages includes all ages from 18 to 65 inclusive, which is expressed as 18 <= age <= 65.
Complete the code to check if a test input belongs to the invalid age partition (less than 18).
def is_invalid_age(age): return [1]
The invalid age partition for ages less than 18 is correctly checked with age < 18.
Fix the error in the code that checks if age is in the valid partition (18 to 65 inclusive).
def check_age(age): if age [1] 18 and age <= 65: return True else: return False
The correct condition to check if age is between 18 and 65 inclusive uses >= for the lower bound and <= for the upper bound. Here, the first blank should be >=.
Fill both blanks to complete the function that returns True if age is in the valid partition (18 to 65 inclusive).
def valid_age(age): return age [1] 18 and age [2] 65
The valid age range includes ages greater than or equal to 18 and less than or equal to 65, so the correct operators are >= and <=.
Fill all three blanks to create a dictionary comprehension that maps each age in the valid partition to True.
valid_ages = { [1]: True for [2] in range(18, [3]) }The dictionary comprehension uses 'age' as the key and loop variable, and the range should go up to 66 to include age 65 (since range excludes the end).