util_m.py:
import sys def util_test(string): ''' parameter description: string: string of object return none ''' print(string) list1=['1',2,3,4] def built(): hello() def is_less_than10(number): if number < 10: return 1 else: return 0 def is_between_5_to_15(number): if not (5<number<15): return 0 else: return 1 if __name__ == '__main__': util_test('this is util test function')
test_main.py:
import sys import util_m import fractions import math def my_test(name, age = 20): ''' parameter description: name: name of object age: age of object return none ''' print(name) print(age) print('aa') if age < 20: raise ValueError('age should be max or equal to 20') print('aa') if __name__ == '__main__': try: my_test('xfei',21) except ValueError: printf('error happen') try: my_test('jang',18) except ValueError: print('error happen') print(util_m.util_test.__doc__) print(util_m.__name__) print(isinstance(1, int)) print(isinstance(True, bool)) print(isinstance(1.0, float)) if 0: print(1==2) else: print(1==1) print(11/2) print(11//2) print(11.0//2) print(11**2) print(11%2) x=fractions.Fraction(2,6) print(x) print(x*2) print(math.sin(math.pi/2)) print(math.tan(math.pi/4))