docs: Add comment explaining automatic base detection in int() conversion

This commit is contained in:
Andreas Koepf (aider) 2025-02-21 17:15:22 +01:00 committed by Andreas Koepf
parent 5ff957a766
commit bae97aa795

View file

@ -96,8 +96,9 @@ def verify_solution(problem, user_solution):
"""
try:
correct_value = eval(problem)
# Use base=0 for automatic base detection: 0x->hex, 0b->binary, 0o->octal, no prefix->decimal
user_value = int(str(user_solution), 0)
except Exception as e:
except Exception:
return False
return correct_value == user_value