Beispiel #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))


    
Beispiel #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")
Beispiel #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')
Beispiel #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))
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')
#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')

Beispiel #7
0
from mymath import gcd, fact

assert(gcd(18, 12) == 6)
assert(fact(6) == 6*fact(5))
Beispiel #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))