Q:

For loop that splits strings by n characters

I found this code that does exactly what I want, it splits a string by n characters. But can somebody explain to me what this code looks like in a long-form for loop? 
n = 3
chunks = [str[i:i+n] for i in range(0, len(str), n)]
print(chunks)

I have a hard time understanding the logic of this code in it's current format. If I were to re-write it, it would look something along the lines of the code below, but can't replicate the results.
for i in range(0, len(str), n):
    chunks = ''
    string = str[i*n::n]
    chunks = chunks+string

Source of code

A:

A list comprehension that looks like
result = [value for element in iterable]

is exactly equivalent to the following code:
result = []
for element in iterable:
    result.append(value)

Consequently your code would be simply
chunks = []
for i in range(0, len(str), n):
    chunks.append(str[i:i+n])

