Giter Club home page Giter Club logo

psyc161-hw-factorial's Introduction

PSYC161 Homework #1

This homework is a part of the PSYC161 Introduction to Programming for Psychologists & Neuroscientists course work.

Ultimate goal

On the example of a simple Python script/function establish practice of

  • interaction with Git and GitHub
  • automated testing using py.test
  • code syntax conventions validation using flake8

Problem to solve

We are creating a new design for an fMRI experiment, for which we will have a single trial per each of n different independent conditions per run.

Question: how many possible trial orders there could possibly be?

Approach: estimate the factorial of n

Solution:

  1. Write factorial to estimate factorial of an integer n (could be plain iteration or a recursive call). See wikipedia if not sure about what factorial is

"Extra credit"

  1. Write both recursive and non-recursive version of a factorial function

  2. Investigate difference (well - ratio) in time of execution between the two. Use time module to track time.

HOWTO

  • "Fork" (which is really just a GitHub term for "clone" on GitHub site, no "git clone" to be done to local drive), this repository on GitHub

  • In the terminal now run

      git clone https://github.com/YOURLOGIN/psyc161-hw-factorial
    

    to "clone" your remote fork/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 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 all tests_ present in the file using python -m pytest -s -v factorial.py (run man pytest 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-hw-factorial) 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 pytest 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.

psyc161-hw-factorial's People

Contributors

yarikoptic avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.