Source code for my_test_package.mymodule

"""A simple module with trivial functions"""

[docs]def multiply(a, b): """Multiply two numbers, a and b A simple wrapper around the python `*` operator. Calls `a * b`. Multiplying two ints will return an int, otherwise float. :param a: the first number :param b: the second mumber :type a: int,float,... :type b: int,float,... :return: a times b :rtype: int,float,... >>> multiply(5, 5) 25 >>> multiply(0.2,10) 2.0 """ return(a*b)
[docs]def multiplication_table(n): """Makes a multiplication table for n, n times x for x up to n :param n: the number :type n: int :return: the multiplication table :rtype: str """ table = '' for i in range(1, n+1): table += "{} times {} is {}\n".format(n, i, multiply(n, i)) return(table.strip())
[docs]def add(a, b): """Adds two numbers :param a: number :param b: other number :type a: int,float,... :type b: int,float,... >>> add(1,2) 3 >>> add(0, 0) 0 >>> add(0.3, 0.7) 1.0 """ return(a+b)