tessl install tessl/pypi-us@3.2.0A package for easily working with US and state metadata
Agent Success
Agent success rate when using this tile
88%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.24x
Baseline
Agent success rate without this tile
71%
Build a utility that validates and resolves US state FIPS codes from user input.
Your system should accept a list of potential FIPS codes (as strings) and return information about their validity and corresponding states.
Implement a function validate_fips_codes(codes) that:
valid: list of tuples, each containing (fips_code, state_name, state_abbreviation) for valid codesinvalid: list of codes that are not valid FIPS codesGiven codes ["01", "06", "24", "99", "invalid"], the function returns valid entries for "01" (Alabama), "06" (California), and "24" (Maryland), and marks "99" and "invalid" as invalid @test
Given codes ["78", "72", "00"], the function returns valid entries for "78" (Virgin Islands) and "72" (Puerto Rico), and marks "00" as invalid @test
Given an empty list [], the function returns empty lists for both valid and invalid @test
@generates
def validate_fips_codes(codes):
"""
Validate a list of FIPS codes and return information about valid states/territories.
Args:
codes: List of strings representing potential FIPS codes
Returns:
Dictionary with keys:
- 'valid': List of tuples (fips_code, state_name, abbreviation)
- 'invalid': List of invalid codes
"""
passProvides US state and territory metadata including FIPS code lookup capabilities.