A views badge written by an AI

Code review · Medium · §6.6 [Pair coding with AI] Asking for branching code

You asked an AI for code that decides a post's badge, and this is the code you got. The request was Gold for 1000 or more views, Silver for 100 or more, and Bronze for everything else. The code runs without errors, but a post with 5000 views gets Silver. Fix just one line so that each post gets exactly one badge, as requested. Grading runs your code several times with different numbers of views.

Code to fix

views = 5000

badge = "Bronze"
if views >= 1000:
    badge = "Gold"
if views >= 100:
    badge = "Silver"
print(badge)

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.