Answered step by step
Verified Expert Solution
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:
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started