def f(x):
    return(2-x**2)

def rect(n,a,b):
    s=0
    S=0
    h=(b-a)/n
    for k in range (n):
        s=s+f(a+h*k)*h
    for k in range (1,n+1):
        S=S+f(a+h*k)*h
    return (S,"<I<",s)

print (rect(100,1,0))

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: