If the string contains an odd number of characters, how to add a ( _ ) character after the last character
If the string contains an odd number of characters, how to add a ( _ ) character after the last character Question: How to add a character(_) after the last character? def split_string(string: str) -> list: n = 2 list1 = [string[i: i + n] for i in range(0, len(string), n)] return list1 print(split_string("123456")) # …