Package: arithmeticTrainer
Python Package Arithmetic TrainerThis package allows users to test their basic arithmetic and mental math skills.Documentationadd(a, b)The add function takes in two numbers (a, b) and returns the sum.fromteam1ArithmeticTrainerimportfunctionsfunctions.add(5,10)subtract(a, b)The subtract function takes in two numbers (a, b) and returns the difference.fromteam1ArithmeticTrainerimportfunctionsfunctions.subtract(10,5)multiply(a, b)The multiply function takes in two numbers (a, b) and returns the product.fromteam1ArithmeticTrainerimportfunctionsfunctions.multiply(10,5)divide(a, b)The divide function takes in two numbers (a, b) and returns the quotient.fromteam1ArithmeticTrainerimportfunctionsfunctions.divide(10,5)sqr_root(a)The sqr_root function takes in one number (a) and returns the square root.fromteam1ArithmeticTrainerimportfunctionsfunctions.sqr_root(16)cube_root(a)The cube_root function takes in one number (a) and returns the cube root.fromteam1ArithmeticTrainerimportfunctionsfunctions.cube_root(27)modulus(a, b)The modulus function takes in two numbers (a, b) and returns the remainder.fromteam1ArithmeticTrainerimportfunctionsfunctions.modulus(27,5)checkPerfectSquare(num)The checkPerfectSquare function takes in one number (num) and checks if it is a perfect square.fromteam1ArithmeticTrainerimportfunctionsfunctions.checkPerfectSquare(16)checkPerfectCube(num)The checkPerfectCube function takes in one number (num) and checks if it is a perfect cube.fromteam1ArithmeticTrainerimportfunctionsfunctions.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.fromteam1ArithmeticTrainerimportfunctionsfunctions.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.fromteam1ArithmeticTrainerimportfunctionsfunctions.print_prompt(add,5,10)Program utilizing all functions (Note some of the above functions are auxiliary functions)How to install and use this packageTryinstalling and using your packagein a separate Python project:Create apipenv-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 apipenvvirtual environment in the same directory, you may have to delete the old one first. Find out where it is located with thepipenv --venvcommand.)Activate the virtual environment:pipenv shell.Create a Python program file that imports your package and uses it, e.g.from examplepackagefb1258 import wisdomand thenprint(wisdom.get())(replacewisdomandget()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 thepipenvvirtual environment as before.Run the package directly from the command line:python3 -m examplepackagefb1258. This should run the code in the__main__.pyfile.Exit the virtual environment.How to run unit testsSimple example unit tests are included within thetestsdirectory. 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 tipWhile 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, runpipenv install -e .from the main project directory.Team MembersKevin GongDixit TimilsinaJames LiuLink to Package on PyPiArithmetic Trainer