Karan's company makes software that provides different features based on the version of operating system of the user.

For finding which version is more recent, Karan uses the following method:

While this function worked for OS versions 10.6, 10.7, 10.8 and 10.9, the Operating system company just released OS version 10.10.

Karan's function fails for the new version:

```python
compare_versions ("10.9", "10.10");       # returns True, while it should return False
```

Karan now wants to spend some time to right a more robust version comparison function that works for any future version/sub-version updates.

Help Karan write this function. Here are a few sample cases:

```python
compare_versions("11", "10");                    # returns True
compare_versions("11", "11");                    # returns True
compare_versions("10.4.6", "10.4");              # returns True
compare_versions("10.4", "11");                  # returns False
compare_versions("10.4", "10.10");               # returns False
compare_versions("10.4.9", "10.5");              # returns False
```
```haskell  
compareVersions "11" "10"       `shouldBe` GT
compareVersions "10.4.6" "10.4" `shouldBe` GT
compareVersions "10.10" "10.9"  `shouldBe` GT
compareVersions xs xs           `shouldBe` EQ -- xs is an arbitrary version
compareVersions "10" "11"         `shouldBe` LT
compareVersions "10.4" "10.4.6"   `shouldBe` LT
compareVersions "10.99" "10.100"  `shouldBe` LT
```

It can be assumed that version strings are non empty and only contain numeric literals and the character `'.'`.

Difficulty: introductory

Starter code:

def compare_versions(version1, version2):
	

Solutions:
def compare_versions(ver1,ver2):
    return [int(i) for i in ver1.split(".")] >= [int(i) for i in ver2.split(".")]


def compare_versions(version1,version2):
    from distutils.version import LooseVersion, StrictVersion
    return LooseVersion(version1) >= LooseVersion(version2)


from distutils.version import LooseVersion

def compare_versions(version1,version2):
    return LooseVersion(version1) >= LooseVersion(version2)

from distutils.version import LooseVersion, StrictVersion
def compare_versions(v1,v2):
    return LooseVersion(v1) >= LooseVersion(v2)

import itertools

def compare_versions(v1,v2):
    p = list(map(int, v1.split('.')))
    q = list(map(int, v2.split('.')))
    for i, v in itertools.zip_longest(p, q, fillvalue=0):
        if i < v:
            return False
    return True

def compare_versions(v1, v2):
    return [int(n) for n in v1.split(".")] >= [int(n) for n in v2.split(".")]

from distutils.version import LooseVersion


def compare_versions(version1, version2):
    v1 = LooseVersion(version1)
    v2 = LooseVersion(version2)
    return v1 >= v2

def compare_versions(version1, version2):
    v1 = version1.split('.')
    v2 = version2.split('.')
    a = max(len(v1), len(v2))
    v1.append('0'*abs(len(v1) - a))
    v2.append('0'*abs(len(v2) - a))
    if v1[-1] == '':
        v1.pop(-1)
    if v2[-1] == '':
        v2.pop(-1)
    k = 0
    for i in v1:
        if int(i) < int(v2[k]):
            return False
        elif int(i) >= int(v2[k]):
            k += 1
    return True

def compare_versions(version1, version2):
    v1 = map(int, version1.split('.'))
    v2 = map(int, version2.split('.'))
    return list(v1) >= list(v2)