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

one value error at function examples #3

Open
tejeshvaish opened this issue Apr 1, 2020 · 1 comment
Open

one value error at function examples #3

tejeshvaish opened this issue Apr 1, 2020 · 1 comment

Comments

@tejeshvaish
Copy link

:

simple python function

def poly(poly_idx, x):
value = 0
l = len(poly_idx) - 1

for i in range(l+1):
    value += poly_idx[i]*(x**(l-i))
    
return value

print("x^2 + x + 1 at x = 0 is:", poly([1, 1, 1], 0))
print("x^2 + x + 1 at x = 1 is:", poly([1, 1, 1], 1))
print("x^2 + x + 1 at x = 2 is:", poly([1, 1, 1], 2))
print("2x^2 + x + 1 at x = 2 is:", poly([2, 1, 1], 1))

here in the last line it should be x=1

@shashikg
Copy link
Member

shashikg commented Apr 4, 2020

Hey thanks, I will correct that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants