Esempio n. 1
0
def mult_input():
    """Multiply a and b parameters"""
    a = int(request.args["a"])
    b = int(request.args["b"])
    result = mult(a, b)

    return f"<h1>{result}</h1>"
Esempio n. 2
0
def search_mult():
    """ same but multiplies the two numbers """

    a = int(request.args["a"])
    b = int(request.args["b"])

    return str(mult(a, b))
Esempio n. 3
0
def multiply_nums():
    """Multiply parameters a and b"""
    a = int(request.args.get("a"))
    b = int(request.args.get("b"))

    result = mult(a, b)
    return str(result)
Esempio n. 4
0
def run_mult():
    """multiplies a and b"""
    a = int(request.args.get("a"))
    b = int(request.args.get("b"))
    res = mult(a, b)

    return str(res)
Esempio n. 5
0
def multiplication():
    '''Multiply a by b'''
    a = int(request.args.get('a'))
    b = int(request.args.get('b'))
    result = mult(a, b)

    return str(result)
Esempio n. 6
0
def multiply():
    a = int(request.args.get('a'))
    b = int(request.args.get('b'))

    res = operations.mult(a, b)

    return str(res)
def newPopulation(x0, a, b, npop):
    nx = len(x0)
    nf = 0
    ninf = 0
    pop = []
    n = 0
    ntries = 0
    x = x0
    while ((n < npop) & ((ntries + 1) < 3 * npop)):
        vctr = x[:]
        try:
            nf = nf + 1
            y = f.eval(x)
            ny = len(y)
            for i in range(ny):
                vctr.append(y[i])
            pop.append(vctr)
            n = n + 1
        except Exception as e:
            ninf = ninf + 1
            #print(e)
        r = []
        for i in range(nx):
            r.append(random.uniform(0, 1))
        x = sum(mult(r, res(b, a)), a)
        #print("n: " + str(n) + " ninf: " + str(ninf) + " x: " + str(x))

    return [pop, nx, ny, nf, ninf]
Esempio n. 8
0
def mult_params():
    a = int(request.args.get('a'))
    b = int(request.args.get('b'))
    
    result = mult(a, b)

    return str(result)
Esempio n. 9
0
def multiply():
    """this function multiplies a and b, 
    and if a parameter is missing, the parameter is defaulted to 1"""
    a = int(request.args.get("a", 1))
    b = int(request.args.get("b", 1))
    result = mult(a, b)
    return f"<h1>Multiplying {result}</h1>"
Esempio n. 10
0
def mult_nums():
    """Multiplies a and b"""

    a = int(request.args.get("a"))
    b = int(request.args.get("b"))

    return (str(mult(a, b)))
Esempio n. 11
0
def multipy():
    """Multiplies a and b parameters"""
    a = int(request.args.get("a"))
    b = int(request.args.get("b"))
    result = mult(a, b)

    return str(result)
Esempio n. 12
0
def mult_nums():
    """return a * b """
    a = int(request.args.get("a"))
    b = int(request.args.get("b"))
    result = mult(a, b)

    return str(result)
Esempio n. 13
0
def mult_num():
    """Multiply a and b"""
    a = int(request.args.get("a"))
    b = int(request.args.get("b"))
    result = mult(a, b)

    return str(result)
Esempio n. 14
0
def mult_operation():
	"""Handle get request and multiply a and b params"""

	a = int(request.args.get("a"))
	b = int(request.args.get("b"))

	return str(mult(a, b))
Esempio n. 15
0
def mult_request():
    """Handle GET request to multiply two numbers"""
    a = int(request.args["a"])
    b = int(request.args["b"])

    result = mult(a, b)
    return str(result)
Esempio n. 16
0
def run_mult():
    '''multiple a and b'''
    a = int(request.args.get("a"))
    b = int(request.args.get("b"))
    result = mult(a, b)

    return str(result)
Esempio n. 17
0
def to_mult():
    """multipy a and b params"""

    a = int(request.args["a"])
    b = int(request.args["b"])
    result_mult = mult(a, b)
    # DO WE ALWAYS HAVE TO STRING THE RESULTS???
    return str(result_mult)
Esempio n. 18
0
def get_mult():
    """
    Multiplying a and b and returns result as the body.
    """
    a = float(request.args["a"])
    b = float(request.args["b"])

    return str(operations.mult(a, b))
Esempio n. 19
0
def mult_num():
    '''
    Multiply a and b
    '''
    a = int(request.args.get('a'))
    b = int(request.args.get('b'))
    result = mult(a, b)
    return f"<h1>{a} x {b} is {result}</h1>"
Esempio n. 20
0
def to_mult():
    """Multiply a and b params."""

    a = int(request.args.get('a'))
    b = int(request.args.get('b'))
    result = mult(a, b)

    return str(result)
Esempio n. 21
0
def _muliplyt(a, b):
    """Calls mult() function from operations and returns the result."""
    a = int(request.args.get("a"))
    b = int(request.args.get("b"))

    multiplication = mult(a, b)
    html = f"<html><body><h1>{a} * {b} is...</h1><h3>{multiplication}</h3></body></html"
    return html
Esempio n. 22
0
def do_mult():
    """Multiply a and b parameters."""

    a = int(request.args.get("a"))
    b = int(request.args.get("b"))
    result = mult(a, b)

    return str(result)
Esempio n. 23
0
def mult_a_and_b():
    """handles multiply functionality"""
    try:
        a = int(request.args['a'])
        b = int(request.args['b'])
        return str(operations.mult(a, b))
    except Exception as e:
        return f"{e}"
Esempio n. 24
0
def mult_query_string_options():
    """Handle GET: Multiply a and b and return result in body."""

    a = int(request.args["a"])
    b = int(request.args["b"])

    result = op.mult(a, b)

    return f"<h1>The multiplication of a and b is {result}!</h1>"
Esempio n. 25
0
def calc(operation):
    a, b = int(request.args['a']), int(request.args['b'])
    OPERATIONS = {
        "add": add(a, b),
        "sub": sub(a, b),
        "mult": mult(a, b),
        "div": div(a, b)
    }
    return str(OPERATIONS[operation])
Esempio n. 26
0
def mult_nums():

    """Multiplies a and b"""

    a = int(request.args["a"])
    b = int(request.args["b"])

    result = mult(a, b)

    return f"{a} x {b} = {result}" 
Esempio n. 27
0
def math(operation):
    a = float(request.args["a"])
    b = float(request.args["b"])
    operations_dict = {
        'add': operations.add(a, b),
        'sub': operations.sub(a, b),
        'mult': operations.mult(a, b),
        'div': operations.div(a, b)
    }
    return str(operations_dict[operation])
Esempio n. 28
0
def mult():
    '''It takes 2 parameters and multiplies them
    >>> 4 * 5 = 20
    '''
    # the args from query string do not go in the
    # params for the fx thats only variables
    a = int(request.args.get("a"))
    b = int(request.args.get('b'))
    result = mult(a, b)
    return str(result)
Esempio n. 29
0
def math_funcs(oper):
    a = int(request.args['a'])
    b = int(request.args['b'])
    ops = {
        'add': operations.add(a, b),
        'sub': operations.sub(a, b),
        'mult': operations.mult(a, b),
        'div': operations.div(a, b),
    }

    return str(ops[oper])
Esempio n. 30
0
def math_task(task):
    """perform add, sub, mult, div using math route"""
    a = int(request.args["a"])
    b = int(request.args["b"])
    task_dict = {
        "add": add(a, b),
        "sub": sub(a, b),
        "mult": mult(a, b),
        "div": div(a, b)
    }
    op_func = task_dict[task]
    return str(op_func)