talkpython/100daysofcode-with-python-course

in byte 89 longest state - there are north and south crolina

Closed this issue · 1 comments

in the same length .... it returns me an error :

def test_get_longest_state():
  assert get_longest_state(us_state_abbrev) == 'South Carolina'

E AssertionError: assert 'North Carolina' == 'South Carolina'
E - North Carolina
E ? ^ ^
E + South Carolina
E ? ^ ^

Hey Yosef, good point, thanks.

I did not hit this because I did not reverse the sort: sorted(data, key=len)[-1]

I updated the tests to accept both Carolinas as correct answers here:

correct_answers = ('North Carolina', 'South Carolina')
assert get_longest_state(us_state_abbrev) in correct_answers
assert get_longest_state(states) in correct_answers