mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-19 12:58:07 +00:00
docs: Add comment explaining automatic base detection in int() conversion
This commit is contained in:
parent
5ff957a766
commit
bae97aa795
1 changed files with 2 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue