math - What is the mathematical operation called that performs all possible operations on two variables and how would I do this in python? -
given 2 variables x,y mathematical operation called recursivley perform:
y=y+x y=y-x y=y*x y=y/x y=y**x y=y**1/x ... and possible itterate through methods in math object in python performing them on x,y values?
in range(1,10): method in math: return math.method(i)?
9.9. operator — standard operators functions shows list of functions in import operator name functions can used in place of various operators (such add). create list containing these operator functions , loop through list. note must careful treat 1 argument , 2 argument functions seperately avoid fatal error when call them.
the operator module exports set of efficient functions corresponding intrinsic operators of python. example, operator.add(x, y) equivalent expression x+y. function names used special class methods; variants without leading , trailing __ provided convenience.
the functions fall categories perform object comparisons, logical operations, mathematical operations, sequence operations, , abstract type tests.
Comments
Post a Comment