primepackage package — Prime documentation

# primepackage package

## Submodules

## primepackage.primeio module

Function for io operations

In Spring 2020, to demo how to build a Python project, this project was created for the students in CS4900 senior seminar class. This module contains the functions about input and output the prime nubmers into or from a csv file.

Example:

  python primeio.py

`primepackage.primeio.` `read_primes`(file_name)

  Read a list of prime numbers from a csv file

  Args:

    file_name (str): file name of a csv file

  Raises:

    IOError: if file is not able to be read

  Examples:

        >>> l = read_primes('output.csv')

`primepackage.primeio.` `write_primes`(prime_list, file_name)

  Output a list of prime numbers into a csv file

  Args:

    prime_list (list): a list of prime numbers file_name (str): file name of a csv file

  Raises:

    IOError: if file is not able to be opened

  Examples:

        >>> write_primes([2, 3, 5, 7], 'output.csv')

## primepackage.primemodule module

Functions for prime numbers

In Spring 2020, to demo how to build a Python project, this project was created for the students in CS4900 senior seminar class. This module contains the functions about prime numbers.

Example:

  python primemodule.py

`primepackage.primemodule.` `get_n_prime`(num)

  Get the fist num prime numbers

  Args:

    num (int): the number of the first prime numbers

  Return:

    list: a list of integer numbers

  Examples:

        >>> prime_list = get_n_prime(10)

`primepackage.primemodule.` `is_prime`(number)

  Check if a number is a prime

  Args:

    number (int): integer number

  Return:

    boolean: true if n is a prime number, false otherwise

  Raises:

    ValueError: if n is not a natural number

  Examples:

        >>> b = is_prime(83)

## Module contents