0

Python output question def f(x)

So lost on this one, Indiana Jones couldn't help me. def f(x): return (2*x+1) def g(x): return(x-1) print(g(f(2))-f(g(2)) Output: 1 (2*-1)+1=5 (2*2)+1=5 5-5=0 So why is the answer 1?

18th Mar 2019, 3:47 AM
tristach605
tristach605 - avatar
1 Resposta
+ 4
f(2) == 2*2 + 1 == 5. g(f(2)) == g(5) == 5 - 1 == 4. g(2) == 2 - 1 == 1. f(g(2)) == f(1) == 2*1 + 1 == 3. g(f(2)) - f(g(2)) == 4 - 3 == 1.
18th Mar 2019, 4:06 AM
Diego
Diego - avatar