Question: Homework 9 Write a function linear(m,b) that prints out the (x,y) values for the function y = mx + b. Inside your function, use a

 Homework 9 Write a function linear(m,b) that prints out the (x,y)

Homework 9 Write a function linear(m,b) that prints out the (x,y) values for the function y = mx + b. Inside your function, use a for loop to generate the list L = (-10,-9,-8,...9,10] of integers from - 10 to 10. Then have your function evaluate the formula y = mx+b for all the values x in L. Your function should return all 21 of those y values as a LIST and not a string. If we were to graph the values of y vs. x, they would lie on a straight line with slope m and y-intercept b. Example >> linear(2,-1) ## slope = 2, y-intercept = -1 output>> [-21, -19,-17,-15,...up to 19] #Must be a list of floats, not strings The input & print statements shown here at the end are so the function can be tested. Always test your functions! Save & Run Load History Show CodeLens 1 2 2 3 4 m = float (input ("Enter a slope ")) 5 b = float(input ("Enter a y-intercept 6 print (linear (m,b)) 7 ")) Activity: 1 ActiveCode (hw9xDE)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!