+ 1
Can someone please explain this program? #Python
def f(x): return g(x)+3%2 def g(x): return x**2+2 print(f(g(1))) Correct answer is 12.. but I don't know how.. Please explain... How I think it is done. First g(1) is solved.. so g(1)= 1**2+2 = 3 Now it becomes f(3) From definition of f we have g(x) + 1 which means 3+1= 4 So according to me the answer is 4 but idk how it comes to be 12.. even tried running this program. Thanks
4 Respuestas
+ 3
f(3) returns g(3) + 3 % 2.
g(3) returns 11 (3**2 + 2)
11 + 3 % 2 = 12.
+ 2
~ swim ~ thanks once again.