All problems
Model Version Bump
Problem
Return the next semantic version string after bumping major, minor, or patch. A major bump resets minor and patch to 0, a minor bump resets patch to 0, and a patch bump increments the third number. Unknown bump names or malformed versions return the version unchanged.
Hint
A registry bump marks a new immutable artifact so rollbacks can point at the previous version.
Test cases
case 1
in: ["1.4.9","patch"]
expected: "1.4.10"
case 2
in: ["1.4.9","minor"]
expected: "1.5.0"
case 3
in: ["1.4.9","major"]
expected: "2.0.0"
case 4
in: ["2.0.0","other"]
expected: "2.0.0"
case 5
in: ["1.4","patch"]
expected: "1.4"
Starter codePython
def bump_version(version, part):
# Your code here
pass5 test cases · run your code against them in the editor