Giter Site home page Giter Site logo

pythontechchallenge's Introduction

PythonTechChallenge

Python Tech Challenge

The challenge is to create a program that computes some 
basic statistics on a collection of small positive integers. You 
can assume all values will be less than 1,000.

Implement this challenge in whatever programming language 
best highlights your skills. Also, please supply a README with 
details on how to setup and run your application

Requirements

The DataCapture object accepts numbers and returns an object for querying
statistics about the inputs. Specifically, the returned object supports
querying how many numbers in the collection are less than a value, greater
than a value, or within a range.
Here’s the program skeleton in Python to explain the structure:
capture = DataCapture()
capture.add(3)
capture.add(9)
capture.add(3)
capture.add(4)
capture.add(6)
stats = capture.build_stats()
stats.less(4) # should return 2 (only two values 3, 3 are less than 4)
stats.between(3, 6) # should return 4 (3, 3, 4 and 6 are between 3 and 6)
stats.greater(4) # should return 2 (6 and 9 are the only two values greater 
than 4)

Challenge conditions:

> You cannot import a library that solves it instantly
> The methods add(), less(), greater(), and between() should have constant time O(1)
> The method build_stats() can be at most linear O(n)
> Apply the best practices you know
> Share a public repo with your projec

Testing:

The test_data_capture.py file has the tests for all the methods of the data_capture file.

Run the follow thess steps
1. open new terminal
2. in the Python shell execute the command: python test_data_capture.py

Running the challenge code.

The data_capture.py file has the code to resolve the challenge

Run the follow thess steps
1. open new terminal
2. execute the command python
2. in the Python shell execute these commands: 
    >>> from data_capture import DataCapture
    >>> capture = DataCapture()
    >>> capture.add(3)
    >>> capture.add(4)
    >>> capture.add(3)
    >>> capture.add(9)
    >>> capture.add(6)
    >>> stats = capture.build_stats()
    >>> print(stats.less(4))
    >>> print(stats.between(3,6))
    >>> print(stats.greater(4))

pythontechchallenge's People

Contributors

des3acr avatar giova-fonseca avatar

Watchers

 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.