state_bases = {
'California': [
{'name': 'Fort Irwin', 'type': 'Army'},
{'name': 'Edwards AFB', 'type': 'Air Force'}
],
'Virginia': [
{'name': 'Fort Lee', 'type': 'Army'},
{'name': 'Langley AFB', 'type': 'Air Force'}
],
# Add other states and bases as needed
}
def search_by_state(state):
"""Search bases by state."""
bases = state_bases.get(state, [])
if not bases:
print(f"No bases found in {state}.")
else:
print(f"Bases in {state}:")
for base in bases:
print(f"- {base['name']} ({base['type']})")
def get_base(state, base_name):
"""Get a specific base in a state."""
bases = state_bases.get(state, [])
for base in bases:
if base['name'] == base_name:
return base
print(f"No base named {base_name} found in {state}.")
return None
# Usage
search_by_state('California')
base_info = get_base('California', 'Fort Irwin')
if base_info is not None:
print(f"Selected base: {base_info['name']} in {base_info['type']}")