Ejemplo n.º 1
0

import mymath as m

a, b = 26, 16

if __name__ == '__main__':
    print(__name__)
    print(m.__name__)
    print(m.pi)
    print(m.gcd(a, b))
    print(m.factorial(6))


    
Ejemplo n.º 2
0
import mymath

print('---Hello Python 3.5.2---')
print('pi is ' + str(mymath.pi))
print('gcd of 24 and 16 is ' + str(mymath.gcd(24, 16)))
print('factoirial of 6 is ' + str(mymath.factorial(6)))
print('---Bye Python 3.5.2---')

if __name__ == '__main__':
    print("as main program")
else:
    print("as module")
Ejemplo n.º 3
0
def main():
    print('Hello Pythin')
    print('pi is ' + str(mymath.pi))
    print('gcd(%d, %d) is %d' % (a, b, mymath.gcd(a, b)))
    print('factorial(%d) is %d' % (6, mymath.factorial(6)))
    print('Bye Python')
Ejemplo n.º 4
0
 def testGCD(self):
     for i in range(100):
         a, b = random.randrange(100000), random.randrange(100000)
         self.assertEqual(mymath.gcd(a, b), math.gcd(a, b))
Ejemplo n.º 5
0
def main():
    print('Hello Python')
    print('pi is ' + str(mymath.pi))
    print('gcd(%d, %d) is %d' % (a, b, mymath.gcd(a, b)))
    print('factorial(%d) is %d' % (6, mymath.factorial(6)))
    print('Bye Python')
Ejemplo n.º 6
0
#import mymath
#from mymath import pi, gcd, factorial
import mymath as m

print('Hello Python')
print('pi is ' + str(m.pi))
print('gcd of 24 and 16 is ' + str(m.gcd(24, 16)))
print('factorial of 6 is ' + str(m.factorial(6)))
print('Bye Python')

if __name__ == '__main__':
    print('myhello as main program')
else:
    print('myhello as module')

Ejemplo n.º 7
0
from mymath import gcd, fact

assert(gcd(18, 12) == 6)
assert(fact(6) == 6*fact(5))
Ejemplo n.º 8
0
import mymath as m

a, b = 26, 16

if __name__ == "__main__":
    print(__name__)
    print(m.__name__)
    print(m.pi)
    print(m.gcd(a, b))
    print(m.factorial(6))