defpad_zero_to_left(inputNumString, totalLength): ''' takes inputNumString as input, pads zero to its left, and make it has the length totalLength 1. calculates the length of inputNumString 2. compares the length and totalLength 2.1 if length > totalLength, raise an error 2.2 if length == totalLength, return directly 2.3 if length < totalLength, pads zeros to its left ''' lengthOfInput = len(inputNumString) if lengthOfInput > totalLength: raise LengthError("The length of input is greater than the total\ length.") else: return'0' * (totalLength - lengthOfInput) + inputNumString