Welcome to My Module’s documentation!¶
This is going to become the future documentation of My Project
How to calculate the factorial¶
The factorial is a mathematical operation that calculates the product of all the numbers up to the specified integer.
For example, the factorial of 5 would be 1*2*3*4*5 = 120. With our code we can do the following:
>>> from my_module.factorial import factorial
>>> factorial(5)
120
Module factorial¶
This module supplies one function, factorial() to calculate the factorial of an integer. You can imported like this:
>>> from my_module.factorial import factorial
The function Factorial¶
The function factorial is also well documented.
-
my_module.factorial.
factorial
(n)¶ Function to calculate the factorial of a number. First import, and then use, for example:
>>> factorial(5) 120 >>> factorial(-1) Traceback (most recent call last): ... ValueError: n must be >= 0
Parameters: n (int) – Number to calculate the factorial Returns: The calculated factorial Return type: int
Module People¶
Defines two classes, Person and Teacher. You define a person by supplying a name, for example:
>>> from my_module.people import Person, Teacher
>>> me = Person('My Name')
>>> print(me.name)
My Name
>>> you = Teacher('Your Name', 'Math')
>>> print(you.name)
Your Name
>>> print(you.course)
Math
-
class
my_module.people.
Person
(name)¶ Class to store a general person information. For example the name.