BCS_Workshop_Apr_20 icon indicating copy to clipboard operation
BCS_Workshop_Apr_20 copied to clipboard

one value error at function examples

Open tejeshvaish opened this issue 4 years ago • 1 comments

:

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

tejeshvaish avatar Apr 01 '20 08:04 tejeshvaish

Hey thanks, I will correct that

shashikg avatar Apr 04 '20 16:04 shashikg