Replace all â €˜ 0 â €™ with â €˜ 5 â €™ in an input Integer |  ; returns the number to be added to the input to replace all zeroes with five ; amount to be added ; unit decimal place ; a number divisible by 10 , then this is a zero occurrence in the input ; move one decimal place ; Driver code
def replace0with5 ( number ) : NEW_LINE INDENT number += calculateAddedValue ( number ) NEW_LINE return number NEW_LINE DEDENT def calculateAddedValue ( number ) : NEW_LINE INDENT result = 0 NEW_LINE decimalPlace = 1 NEW_LINE if ( number == 0 ) : NEW_LINE INDENT result += ( 5 * decimalPlace ) NEW_LINE DEDENT while ( number > 0 ) : NEW_LINE INDENT if ( number % 10 == 0 ) : NEW_LINE INDENT result += ( 5 * decimalPlace ) NEW_LINE DEDENT number //= 10 NEW_LINE decimalPlace *= 10 NEW_LINE DEDENT return result NEW_LINE DEDENT print ( replace0with5 ( 1020 ) ) NEW_LINE