A boundary that changed in a chained comparison

Code review · Basic · §5.5, §10.1 Readable code

This code counts the posts that have at least 10 but fewer than 50 comments. The original condition was c >= 10 and c < 50, and it was rewritten as a chained comparison to make it easier to read. But now it prints 3 without an error. The answer is 2. Fix just one place.

Code to fix

comments = [8, 10, 32, 50, 75]
count = 0
for c in comments:
    if 10 <= c <= 50:
        count += 1
print(count)

Solve this problem in your browser

Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.