talkpython / 100daysofcode-with-python-course

Course materials and handouts for #100DaysOfCode in Python course
https://training.talkpython.fm/courses/explore_100days_in_python/100-days-of-code-in-python
MIT License
2.09k stars 1.07k forks source link

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

Closed ghost closed 6 years ago

ghost commented 6 years ago

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 ? ^ ^

bbelderbos commented 6 years ago

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