I am stuck in this exercise :
Split the string into pairs of two characters. If the string contains an odd number of characters, then the missing second character of the final pair should be replaced with an underscore (’_’).
here is my solution:
x = "codeacademy" new_lst =  for i in range(0, len(x), 2): new_lst.append(x[i : i+2] print(new_lst)
This one work to split the string into pairs but I am stuck where I suppose to add “_” if the last character is single so I tried
if len(x) % 2 == 1: x = x.append("_")
but it didn’t work?