Problem in assignment W3D2

question no 2 in W3D2 assignment

please add a photo with question


question no 2 from the assignment W3D2

In this question you need to define the function expression inside the function itself for eg. let’s suppose we have code the below
y = 7x + 5

def f(x):
    y = 7*x+5
    return y

# now when you want to use the function you need to define a value for x like below first
x = 4
# then call the function like below to get the results like below
y = f(x)
print(y) # this print (7*4+5=) 33

so in your code there are two mistakes one is you have not defined the value of x before calling it in function and another is function expression is defined outside the function body.

My suggestion is you need to go through the function lesson again properly because it seems you are missing some essential understanding in implementing function like how to define it and how to call it.

okay sir ,
thanks

Basically , I misunderstood the question , as we needed to get the value according to the formula , but I understood something else .

Thanks

1 Like