Sort version strings of the form MAJOR.MINOR.PATCH with an optional pre-release suffix
-<label> (for example 1.2.0-rc1). Order rules:
1.2.0-rc1 < 1.2.0).An optional leading v is allowed and kept in the output.
Implement sort_versions. Input: versions: list[str]. Returns: list[str] sorted ascending.
def sort_versions(versions: list[str]) -> list[str]:
return sorted(versions)
Run executes the public tests. Submit grades against public and hidden tests.
Sort version strings of the form MAJOR.MINOR.PATCH with an optional pre-release suffix
-<label> (for example 1.2.0-rc1). Order rules:
1.2.0-rc1 < 1.2.0).An optional leading v is allowed and kept in the output.
Implement sort_versions. Input: versions: list[str]. Returns: list[str] sorted ascending.
def sort_versions(versions: list[str]) -> list[str]:
return sorted(versions)
Run executes the public tests. Submit grades against public and hidden tests.