Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm getting this error message found in the code. What am I doing wrong? How do I fix this? Here is the original question: Python

I'm getting this error message found in the code. What am I doing wrong? How do I fix this?

Here is the original question:

Python Question: For the following use a For loop. Write a function MakeSubintF (a, b, n) that returns a list of the endpoints of the subintervals, e.g. MakeSubint (7, 10, 3) should return the list [7, 8, 9, 10]. Verify that your function works with the intervals (a,b) = (7,10) (n=3); (12,19.5) (n=10); and (0,2pi) (n=8).

My code:

image text in transcribed

def MakeSubintF(anD'n): # defines the function MakesubIntF(a,b,n) that returns a list of endpoints length = (b-a) # defines length of subintervals i- a # defines the starting point necessary for the following conditional statement results = [] # sets the list of results for i in range (a,b); results.append(i) # adds 1 to the end of results 1-1 + length # sets the start point for the loop return results # list of endpoints ranging from a to b import math # imports the math library used for pi rl -MakesubintF (7,10,3) # defines the list of endpoints for r1 r2 = MakeSub IntF( 12, 19.5, 10) # defines the list of endpoints for r2 r3 = MakeSubintF(0,2-math.pl, 8) # defines the list of endpoints for r3 print (r1) # prints r1 print (r2) # prints r2 print (r3 ) # prints r3 Traceback (most recent call last) TypeError Kipython-input-17-4a919bcc18f0> in 9 import math # imports the math library used for pi 10 r1 = MakeSubintF (7,10, 3) # defines the list of endpoints for r1 > 11 r2 = MakesubintF (12, 19.5, 10) # defines the list of endpoints for r2 12 r3 -MakeSubintF (0,2 *math. p1,8) # defines the list of endpoints for r3 13 print (r1) # prints r1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago