Python coding help for Hello World!

Im reading the book Hello World for Python and struggling to figure this code out. I type in 4 . Where does the 3 stars come from in the first block and for the second block it starts out with five and increments by 2 then it adds 2 lines per block im missing something… Thanks

numBlocks = int(input('How many blocks of stars do you want? '))
for block in range(1, numBlocks + 1):
    for line in range(1, block * 2):
        for star in range(1, (block + line) * 2):
            print('* ', end='')

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.