Skip to main content

Ormuco and VanHack Code Challenge

The Question The goal of this question is to write a software library that accepts 2 version string as input and returns whether one is greater than, equal, or less than the other. As an example: “1.2” is greater than “1.1”. Please provide all test cases you could think of.

My Solution

Get Started:

  • Clone this repository:
$ git@github.com:jattoabdul/compare_version_strings.git
  • Change into the compare_version_strings directory:
$ cd compare_version_strings
  • Install all dependencies:
$ pip install -r requirements.txt

Run Test:

$ pytest

Run as Packaged Library:

  • Install:
$ pip install jatto_compare_version_strings
  • Usage:
from compare_version_strings.compare_version_strings import compare_versions, prepare_comparison_result

comparison_result = compare_versions('1.0.0.2.9', '1.0.0.3.4')

# It will return:
#     A positive number: If the first version is greater than the second  
#     A negative number: If the first version is smaller than the second
#     Zero: If the versions are equals

formated_result = prepare_comparison_result('1.0.0.2.9', '1.0.0.3.4')

# It will return:
#     '{version1}' is equal to '{version2}': If the comparison returns 0
#     '{version1}' is smaller than '{version2}': If the comparison returns -1
#     '{version1}' is greater than '{version2}': If the comparison returns 1

Release files for jatto-compare-version-strings 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jatto-compare-version-strings 0.0.1
File Size Uploaded
jatto_compare_version_strings-0.0.1.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jatto-compare-version-strings 0.0.1
File Interpreter ABI Platform
jatto_compare_version_strings-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.2 kB

Release files / jatto_compare_version_strings-0.0.1.tar.gz

Download URL jatto_compare_version_strings-0.0.1.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0bd531d90641ba8a7368aa3ba30eec2f8dae26a8f1548ef682c4c1af257ad04e
BLAKE2b-256 checksum
How to use checksums
fabd0b88dde0e14a4f8d73448e085cf4e9f39996e43367738018ef1ca26442fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.2

Release files / jatto_compare_version_strings-0.0.1-py3-none-any.whl

Download URL jatto_compare_version_strings-0.0.1-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
37d3287c62e04a2d33939a42686b11c6ae30557f97d7f02b640b236948519357
BLAKE2b-256 checksum
How to use checksums
3cdf85b111eac8f82403685904925c2eacee070ec0ba57f89f9250e4d01cb14c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.2

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page