test push
This homework is a part of the PSYC161 Introduction to Programming for Psychologists & Neuroscientists course work.
On the example of a simple Python script/function establish practice of
- interaction with Git and GitHub
- automated testing using nose
- code syntax conventions validation using flake8
- Write recursive
factorial_recursive
to estimate factorial of an integer n. See wikipedia if not sure about what factorial is
-
Write non-recursive version of a
factorial
function -
Investigate difference (well - ratio) in time of execution between the two. Use
time
module to track time.
-
"Clone" this repository on GitHub
-
In the terminal run
git clone https://github.com/YOURLOGIN/psyc161-hw1
to clone your remote clone to your local drive
-
Edit file
factorial.py
which provides a skeleton for your work -
You are welcome to use any editor to edit the file, but we recommend starting to work with PyCharm
-
Function
factorial_recursive
definition provides a skeleton for you to fill in (docstring + implementation) -
Test
test_factorial()
implements basic checks already which you need to expand to degree you feel necessary to state with assurance that your implementation. You can run alltests_
present in the file usingnosetests -s -v factorial.py
(runman nosetests
in a terminal to check what options -s and -v are for. Do you need them both really ATM?) -
git commit -m "Description of your changes" -a
your work. Could be done multiple times -
Make sure that your code passes tests, and also conforms to PEP8 - Style Guide for Python Code by running
flake8 factorial.py
and addressing noted issues. -
Whenever you are ready to submit your homework, run
git push
to push your changes back to your clone on GitHub -
Visit your GitHub page (http://github.com/YOURLOGIN/psyc161-hw1) and find your changes being present among Commits, and "Send a pull request" option present.
-
Send a "Pull request" against my original repository for review of the changes etc.
-
Review status of the pull request in a few minutes -- it should report successful pass through travis CI run which runs again nosetests and flake8 on my behalf. If not -- inspect travis's logs, commit fixes locally, push them to github again so that PR gets updated, and travis gets another run.