Skip to main content

LeetPride makes for a beautiful problem solving and learning environment for test and timing data structures and algorithms. Happy Pride everyone and may the leet coding favor your fortune.

Project description

L e e t P r i d e

To make algorithm and data structure learning more exciting, colorful and enjoyable.

LeetPride interrogates the created classes and runs the tests specified to ensure success and optimize focus on problem-solving maximizing data structure an algorithm absorption, groking and satisfaction.

One time Setup

>simply install with

pip install LeetPride

LeetPride depends on modules listed in requirements.txt

It is recommended to create a venv and install the requirements.

   python3 -m venv venv
   ./venv/scripts/activate
   python3 -m pip install -U pip
   python3 -m pip install -r requirements.txt 

Screenshot of the 4 simple steps running in seconds. img

Happy Problem Solving and Happy Pride !!

Quickly get going on given any problem by simply creating a py file to begin coding solutions starting with import then common python boilerplate for generating and running tests on solutions.

There are 4 basic simple setups to get going in seconds. The last is the code you will write and generally goes first, followed by generate_tests() and then the main boilierplate runners. Also, there are capabilities to easily test and time multiple method implementations and different class method call sequencing for class testing.

  1. from leetpridecore import *
    
  2. The standard main for running Class and Method solution tests is as follows:

    def main() -> Optional[int] | None:
        tests_unified = generate_tests()
        lpc = LeetPrideCore(time_all=True)
        lpc.solution_hash_display(tests_unified)
        any_fail = lpc.run_tests(tests_unified)
        return completion_display(any_fail)
    if __name__ == '__main__':
        exit(main())
    
  3. Multiple examples can be found in the /Examples folder of test generation simplicity and support for complex cases.

    Example of required generate_tests() method using separate tests and expected results zipped together:

    def generate_tests():
        tests = (['Pride', 'loving', ],
                 ['forever !',
                  None,
                  ])
        expected_test_results = [True, 'LGBTQ Lover forever !!!!', ]
    return list(zip(tests[0], tests[1], expected_test_results))
    
  4. For either -method- or -class- solutions:

    • A or B ( but supports mixing too even. )

    A. Class - class questions generally entail verifying output of sequenced method calls:

    class Pride:
        def __init__(self, always)
            self.love = always
         
        def love(sef, equality:str = 'forever') -> bool:
            return self.love == True
    
      B. Method - general class Solution, so to align with LC practices:
    class Solution:
        # @timeit
        def method1(self, nums: List[int], target: int) -> List[int | None]:
            return [nums[target]]
    

A few notes:

Instantiating the LeetCodeCore object takes an optional time_all bool parameter. -- If enabled to True, this will dynamically wrap any non @timeit wrapped methods designated for testing with a @timeit decorator and provide timing duration information detail.

Graphies and Linkies helper methods for easy test setup and printout of representations of node graphs, trees, and linked lists are being cleaned up and will be included in very near term update.

Enjoy!
Tallicia

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

LeetPride-0.6.9.2.1-py3-none-any.whl (25.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page