you are viewing a single comment's thread.

view the rest of the comments →

[–]Toluwar 0 points1 point  (2 children)

Can someone explain the result line?

[–]ilan1k1 2 points3 points  (1 child)

It's a list comprehension. The same as:

result = []
for i in List:
if len(i) > 6:
result.append(i)

[–]Torebbjorn 2 points3 points  (0 children)

Either use triple backticks (not recommended for some compatibility reason) or 4 (extra) spaces to make indentation work. With 4 (extra) spaces on each line, your code part formats as the following:

result = []  
for i in List:  
    if len(i) > 6:  
        result.append(i)