A package meant to train mental math and basic arithmetic
Project description
Python Package Arithmetic Trainer
This package allows users to test their basic arithmetic and mental math skills.
Documentation
add(a, b)
The add function takes in two numbers (a, b) and returns the sum.
from team1ArithmeticTrainer import functions
functions.add(5, 10)
subtract(a, b)
The subtract function takes in two numbers (a, b) and returns the difference.
from team1ArithmeticTrainer import functions
functions.subtract(10, 5)
multiply(a, b)
The multiply function takes in two numbers (a, b) and returns the product.
from team1ArithmeticTrainer import functions
functions.multiply(10, 5)
divide(a, b)
The divide function takes in two numbers (a, b) and returns the quotient.
from team1ArithmeticTrainer import functions
functions.divide(10, 5)
sqr_root(a)
The sqr_root function takes in one number (a) and returns the square root.
from team1ArithmeticTrainer import functions
functions.sqr_root(16)
cube_root(a)
The cube_root function takes in one number (a) and returns the cube root.
from team1ArithmeticTrainer import functions
functions.cube_root(27)
modulus(a, b)
The modulus function takes in two numbers (a, b) and returns the remainder.
from team1ArithmeticTrainer import functions
functions.modulus(27, 5)
checkPerfectSquare(num)
The checkPerfectSquare function takes in one number (num) and checks if it is a perfect square.
from team1ArithmeticTrainer import functions
functions.checkPerfectSquare(16)
checkPerfectCube(num)
The checkPerfectCube function takes in one number (num) and checks if it is a perfect cube.
from team1ArithmeticTrainer import functions
functions.checkPerfectCube(125)
generate_question()
The generate_question function generates a random arithmetic question choosing either an addition, subtraction, multiplication, division, sqr root, modulus, or cube root problem.
from team1ArithmeticTrainer import functions
functions.generate_question()
print_prompt(question, a, b)
The print_prompt function takes three parameters (question, a, b) and prompts the user to answer an arithmetic problem.
from team1ArithmeticTrainer import functions
functions.print_prompt(add, 5, 10)
Program utilizing all functions (Note some of the above functions are auxiliary functions)
How to install and use this package
Try installing and using your package in a separate Python project:
- Create a
pipenv
-managed virtual environment and install the latest version of your package installed:pipenv install -i https://test.pypi.org/simple/ examplepackagefb1258==0.0.7
. (Note that if you've previously created apipenv
virtual environment in the same directory, you may have to delete the old one first. Find out where it is located with thepipenv --venv
command.) - Activate the virtual environment:
pipenv shell
. - Create a Python program file that imports your package and uses it, e.g.
from examplepackagefb1258 import wisdom
and thenprint(wisdom.get())
(replacewisdom
andget()
with any module name and function that exists in your package) . - Run the program:
python3 my_program_filename.py
. - Exit the virtual environment:
exit
.
Try running the package directly:
- Create and activate up the
pipenv
virtual environment as before. - Run the package directly from the command line:
python3 -m examplepackagefb1258
. This should run the code in the__main__.py
file. - Exit the virtual environment.
How to run unit tests
Simple example unit tests are included within the tests
directory. To run these tests...
- Install pytest in a virtual environment.
- Run the tests from the main project directory:
python3 -m pytest
. - Tests should never fail. Any failed tests indicate that the production code is behaving differently from the behavior the tests expect.
Pro tip
While working on the package code, and verifying it behaves as expected, it can be helpful to install the package in "editable" mode so that changes to the package are immediately updated in the virtual environment.
- To do this, run
pipenv install -e .
from the main project directory.
Team Members
Link to Package on PyPi
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file arithmeticTrainer-0.0.1.tar.gz
.
File metadata
- Download URL: arithmeticTrainer-0.0.1.tar.gz
- Upload date:
- Size: 42.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
fe3ff115a60e7b88e84e8cfb56a47d41d98458fab684aa3060cc3c6adf97c459
|
|
MD5 |
2c6aa3a4636ccb1ebe9112b29b9c8b5b
|
|
BLAKE2b-256 |
67da1eb7e88370341524d6619e70365513aa117919bc6a4b5b3096260a7c9a1e
|
File details
Details for the file arithmeticTrainer-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: arithmeticTrainer-0.0.1-py3-none-any.whl
- Upload date:
- Size: 29.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
270c8e78805a86d41215c89e52c631de949eca7740a525fe20d403acb799f1f9
|
|
MD5 |
1fe51abb8a51449b8e75e72913ec5d22
|
|
BLAKE2b-256 |
cd077afd6e7909bfa8ee8b5ab71aadd45a2bf0e48a6e5d4beacbc8fc616dd75e
|