0
How is this 20? Pls if someone could give me a break down of how python process this equation one by one , thanks !
def polynomial(x): return x**2+8*x +44%4 print(polynomial(-10))
4 Answers
+ 6
x**2 => x raised to power 2.
Since x=-10, x**2=>-10*-10=+100.
8*x=8*-10= -80.
44%4=>0 (% means remainder)
So adding 100-80+0 =20..
+ 3
(-10)**2 = 100
8*(-10)= -80
44%4 = 0
----â-----------------
20
+ 1
=> -10**2+8*-10+44%4
=> 100-80+44%4
=>100-80+0
=> 20
Operator precedence in python , look at the bottom of page
https://www.google.com/url?sa=t&source=web&rct=j&url=https://docs.python.org/3/reference/expressions.html&ved=2ahUKEwj4ovqEls_sAhXWzjgGHU3OAzIQFjANegQIAhAB&usg=AOvVaw20xmig3bG9EQm1_XcCKiMh&cshid=1603609366983
0
oh i thought x was the base and the rest of the calculation was for the power . thanks