Example #1
0
 def calculate():
     if symbol == '+':
         add.add()
     elif symbol == '-':
         sub.sub()
     elif symbol == '*':
         mul.mul()
     elif symbol == '/':
         div.div()
     else:
         print('Please use mathematical symbol')
Example #2
0
# Create a package Calculator having four files add.py, sub.py, mul.py 
# and div.py with functions to perform addition, subtraction, 
# multiplication and division respectively. Import Calculator package 
# in your code and implement simple calculator.
from add import add
from sub import sub
from mul import mul
from div import div

print(add(7,5))
print(sub(17,15))
print(mul(8,3))
print(div(7,5))
Example #3
0
def euler(list):
    j = []
    for i in range(13, len(list)):
        a = mul(list[i - 13: i])
        j.append(a)
    return max(j)
Example #4
0
import mul
print(mul.mul(7, 8))
print(__name__)
Example #5
0
import mul

if __name__ == "__main__":
    print(mul.mul(10, 10))
Example #6
0
 def __call__(self, x, train=False):
     branches = []
     for i in six.moves.range(self.branch_num):
         branches.append(self['branch{}'.format(i)](x, train=train))
     x = self.identity(x, train=train)
     return mul(*branches, train=train) + x
Example #7
0
import mul
print(mul.mul(5, 4))
print(__name__)
Example #8
0
 def test_function(self):
     result = mul.mul(2, 4)
     self.assertEqual(result, 8)
Example #9
0
    1 for '+'
    2 for '-'
    3 for 'x'
    4 for '/'
    """)
    return [x,y,op]

def output(result):
    print "The result is:", result

if __name__ == "__main__":
    print "Hello Dummy Cal!"
    
    # get input from user
    result = None
    while result is None:
        (x, y, op) = getUserInput()
        if op == 1: result = add(x, y)
        elif op == 2: result = sub(x, y)
        elif op == 3: result = mul(x, y)
        elif op == 4: result = div(x, y)
        else: print "Please enter a valid operator"
    
    # output result.
    output(result)





Example #10
0
import add
import sub
import mul
import div

	c = add.add(2,3)
	print(c)
	d = sub.sub(2,3)
	print(d)
	a = mul.mul(2,3)
	print(a)
	b = div.div(2,3)
	print(b)
Example #11
0
from add import add
from mul import mul
from Division import div
from subtract import subtract

print("Calculations")
add(4,3)
print(subtract(4,2))
print(div(4,2))
print(mul(4,2))
Example #12
0
resp = []
trec = []
dc = []
import mul
f = open('digit', 'r')
for line in f:
    a = line
b = len(a)
e = 0
while e < (b - 12):
    f = e+13
    c = a[e:f]
    for i in c:
        trec.append(int(i))
    k = (mul.mul(trec))
    resp.append(k)
    e = e + 1
    pp = trec
    dc.append(pp)
    trec = []
print(max(resp))
Example #13
0
import div_u
import mul

print("Enter two space seperated numbers")
a,b = map(int,input().split())

f = open("result.txt", "w")
f.write(div_u._div(a,b)+"\n")
f.write("--------------------"+"\n")
f.write(mul.mul(a,b)+"\n")
f.close()
Example #14
0
def test_m():
    assert mul.mul(2, 3) == 6, 'false'
Example #15
0
import add
import sub
import mul
import div
import exp
import sqrt

a = int(input("a-> "))
b = int(input("b-> "))
print("a+b")
print(add.add(a, b))
print("a-b")
print(sub.sub(a, b))
print("a*b")
print(mul.mul(a, b))
print("a/b")
print(div.div(a, b))
print("a^(b)")
print(exp.exp(a, b))
print("sqrt(a)")
print(sqrt.sqrt(a))
Example #16
0
def thissub(num1, num2):
    thisnum = num1 - num2
    return thisnum


def thismul(num1, num2):
    thisnum = num1 * num2
    return thisnum


def thisdiv(num1, num2):
    thisnum = num1 / num2
    return thisnum


if __name__ == "__main__":
    a = 10
    b = 10

#These num of import
print 'result add :', add.add(a, b)  #add모듈의 함수
print 'result sub :', sub.sub(a, b)  #sub모듈의 함수
print 'result mul :', mul.mul(a, b)  #mul모듈의 함수
print 'result div :', div.div(a, b)  #div모듈의 함수

#These thisnum of calc.py module
print 'this is result add :', thisadd(a, b)  #현재 모듈의 함수
print 'this is result sub :', thissub(a, b)  #현재 모듈의 함수
print 'this is result mul :', thismul(a, b)  #현재 모듈의 함수
print 'this is result div :', thisdiv(a, b)  #현재 모듈의 함수
Example #17
0
import ad
import sub
import mul
import div

print(ad.ad(6, 3))
print(sub.sub(6, 3))
print(mul.mul(6, 3))
print(div.div(6, 3))
"""
num1, num2 = input(": ").split()
print(num1)
print(num2)

print("------")
"""

import sum
import mul
import dec
import div

number1 = input("num1 : ")
number2 = input("num2 : ")

sum.sum(int(number1), int(number2))
dec.dec(int(number1), int(number2))
mul.mul(int(number1), int(number2))
div.div(int(number1), int(number2))
Example #19
0
from add import add
from sub import sub
from mul import mul
from divide import divide
add()
sub()
mul()
divide()