-1

how to split a string into words of 2 letters. Like given string is "HelloThere" now i want to make it ["He","ll","oT","he","re"]. Please help to code that in python.

1 Answers1

0
yourList = []
yourString = "HelloThere"
while yourString:
    yourList.append(yourString[:2])
    yourString = yourString[2:]

If you print yourList, you will get the result.

masonCOD
  • 39
  • 11