def test_add(self): result = mycalc.add(10, 5) self.assertEqual(result, 15) self.assertEqual(mycalc.add(10, 1), 11)
import mycalc print(mycalc.add(19, 23))
from mycalc import add print(add(2, 3)) # 5 from mymath import add print(add(2, 3)) # 6 from mycalc import add print(add(2, 3)) # 5
# this is an script of python calculator # create a file named calc.py # then run the function and see from mycalc import add, sub, mul, div a, b = list(map(int, input("Enter the value of a and b ").split())) print(add(a, b)) print(sub(a, b)) print(mul(a, b)) print(div(a, b))
import mycalc print(mycalc.add(2, 3)) # 5 import mymath print(mymath.add(2, 3)) # 6 import mycalc print(mycalc.add(2, 3)) # 5
def test_add(self): self.assertEqual(mycalc.add(1, 2), 3)
#!/usr/bin/env python import datetime import math import sys import mycalc as hoho from mycalc import add #import enum import sets print "hoho.add=", hoho.add(1,2) print "add=", add(1,2) def squre (n): return n*n class FirstClass: a = "hello" def m(self): print FirstClass.a print "Hello world\n" print 2 print squre (2) #FirstClass.a #FirstClass.m