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 whether two US states share a land border. The utility should provide both a validation function and a simple command-line interface.
Create a Python module that implements the following functionality:
Define a data structure that maps each US state to its bordering states (states that share a land border)
Implement a shares_border(state1, state2) function that:
True if the states share a land border, False otherwiseFalse if either state abbreviation is invalidCreate a simple command-line interface:
A Python library for working with US state and territory metadata.
File: test_border_validator.py
from border_validator import shares_border
def test_adjacent_states():
assert shares_border("MD", "VA") == True
assert shares_border("CA", "OR") == True
assert shares_border("TX", "LA") == TrueFile: test_border_validator.py
from border_validator import shares_border
def test_non_adjacent_states():
assert shares_border("FL", "CA") == False
assert shares_border("ME", "WA") == FalseFile: test_border_validator.py
from border_validator import shares_border
def test_island_states():
assert shares_border("HI", "CA") == False
assert shares_border("AK", "WA") == FalseFile: test_border_validator.py
from border_validator import shares_border
def test_case_insensitive():
assert shares_border("md", "va") == True
assert shares_border("Md", "Va") == TrueFile: test_border_validator.py
from border_validator import shares_border
def test_invalid_codes():
assert shares_border("XX", "YY") == False
assert shares_border("CA", "ZZ") == False