GoalScope — roman_to_int (Qwen2.5-Coder-32B-Instruct) — hover a token to see the patched verbalization
↵
<code>↵
def roman_to_int(s):↵
"""Converts a Roman numeral to an integer."""↵
roman_values = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}↵
total = 0↵
prev_value = 0↵
for char in reversed(s):↵
value = roman_values[char]↵
if value < prev_value:↵
total -= value↵
else:↵
total += value↵
prev_value = value↵
return total↵
</code>