Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete contract in HumanEval #160 (do_algebra) #35

Closed
mrigankpawagi opened this issue Oct 21, 2023 · 0 comments
Closed

Incomplete contract in HumanEval #160 (do_algebra) #35

mrigankpawagi opened this issue Oct 21, 2023 · 0 comments

Comments

@mrigankpawagi
Copy link

mrigankpawagi commented Oct 21, 2023

We need to check for possible ZeroDivisionErrors. Maybe something like the following will be okay.

...
try:
    return eval(exp)
except ZeroDivisionError:
    assert False, "invalid inputs" # $_CONTRACT_$

Alternatively,

assert not any([operand[i-1] == 0 and operator[i] == "//" for i in range(1, len(operand))]), "invalid inputs" # $_CONTRACT_$

may also work.

@ganler ganler self-assigned this Oct 21, 2023
@ganler ganler added bug Something isn't working program contract incomplete and removed bug Something isn't working labels Oct 21, 2023
@ganler ganler closed this as completed in 7f0cf15 Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants