Replace String Using Index In Python 3 The Condition