[Tutor] (no subject)

Dave Angel davea at davea.name
Sat Sep 28 01:46:44 CEST 2013


On 27/9/2013 15:56, Katie wrote:


>
> <font color='black' size='2' face='arial'>Hello,
> <div><br>
> </div>

Please post your messages in text mode, not html.

>
> <div>I am trying to write a program using Python v. 2.7.5 that will compute the area under the curve y=sin(x) between x = 0 and x = pi. Perform this calculation varying the n divisions of the range of x between 1 and 10 inclusive and print the approximate value, the true value, and the percent error (in other words, increase the accuracy by increasing the number of trapezoids). Print all the values to three decimal places. </div>
>
> <div><br>
> </div>
>
> <div>I am not sure what the code should look like. I was told that I should only have about 12 lines of code for these calculations to be done. </div>
>
> <div><br>
> </div>
>
> <div>I am using Wing IDE. I have very basic knowledge in Python.</div>
>
> <div><br>
> </div>
>
> <div>I would appreciate help. </div>
>
> <div><br>
> </div>
>
> <div>Thank you. </div>
> </font>
>

What part do you NOT understand?  Don't worry yet about the line count. 
Just write one function that represents some aspect of the problem that
you do understand.

When that works, write a second function for some other aspect.

-- 
DaveA




More information about the Tutor mailing list