Advanced Python Code Challenges: Lists (challenge 3 bug)

I think there is a bug with the challenge titled " 3. More Frequent Item"
I’ve attached a screenshot of my solution. When I check the answer, the feedback is inconsistent with the output.

Changing if lst.count(item1) > lst.count(item2): to if lst.count(item1) >= lst.count(item2): results in positive feedback, but the solution I have should be correct right?

Given that item1 is the default when both counts are equal the only real concern is whether or not item2 count is greater. If not return item1.

In line 3, swap the items and also swap the two clauses.

1 Like

Thanks @mtf. I can see how that would work.

I was also confused about the feedback system. I thought it was referring to the output of my function, but it is referring to the example given as part of the feedback.

1 Like