0
(1+_) **2 =16
give me answer please
6 Answers
+ 4
sure, you all got the right answer, but that isn't the point of learning how to program, you're not correct until the computer knows the answer is 3 (we learn to solve programmatically, not mathematically.)
so let's start with what we know:
we have 2 variables, a root and some number x we want to find. the math module has a function for solving square roots, otherwise we would need to write our own functions for cubed roots, etc. but that isn't the point to answer here.
from math import sqrt as s <--- Import sqrt function as s
def solveForX(a, b): <---- solving for x with two variables
x = ? <---- what we want to find
we want our function to return the solved value of x:
from math import sqrt as s
def solveForX(a, b):
x =
return x <-----
now we need to determine how x is solved:
x = sqrt16 - 1
or
x = rootb - a
from math import sqrt as s
def solveForX(a, b):
x = s(b) - a <-----
return x
then, we want to print the result:
from math import sqrt as s
def solveForX(a, b):
x = s(b) - a
return x
print(solveForX(1, 16)) <----- a=1, b=16
and now your computer knows the answer is 3.0 (x is returned as a float), and you can solve for other values that follow the same outline (rather than just the one you know now)
+ 1
3
+ 1
1+3=4
4**2=4Ă4
0
=16
0
-5, too
0
1+3=4*4=16