Here's the question I'm working on!
Split Strings
Complete the solution so that it splits the string into pairs of two characters. If the string contains an odd number of characters then it should replace the missing second character of the final pair with an underscore ('_').
def solution(s): answer = [] a = 0 if (len(s) % 2) != 0: a = s + "_" for i in range(len(a) // 2): answer.append(a[2 * i:2 * i + 2]) return answer Traceback (most recent call last): File "main.py", line 13, in <module> test.assert_equals(solution(inp), exp) File "/home/codewarrior/solution.py", line 6, in solution for i in range(len(a) // 2): TypeError: object of type 'int' has no len()
len(s) % 2 == 0?