https://school.programmers.co.kr/learn/courses/30/lessons/120913
def solution(my_str, n):
answer = []
for i in range(int(len(my_str)/n)):
str1 = ''
str1 = my_str[i*n: i*n+n]
answer.append(str1)
if len(my_str) % n != 0:
str2 = ''
str2 = my_str[i*n+n:len(my_str)]
answer.append(str2)
return answer
def solution(my_str, n):
return [my_str[i: i + n] for i in range(0, len(my_str), n)]
https://shoark7.github.io/programming/python/about-list-comprehension-python