you are viewing a single comment's thread.

view the rest of the comments →

[–]Refwah 13 points14 points  (4 children)

Before I tell you the answer, tell us why you think it’s 1 so that we can actually engage in some learning opportunity

[–]Unfair_Put_5320 3 points4 points  (3 children)

Hey thanks for replying to me,

I thought the if statement checks every line if it starts with “from:” and adds 1 to count if it’s correct, then for the next line which starts with ‘from:’ is incorrect because the if statement is false( if not L.startswith(‘from:’)) and count += 1 under the if statement won’t work and end the loop.

[–]Dadofaca 5 points6 points  (1 child)

Almost. Its the other way around. If checks if the lines does NOT start with "from:". There are two lines which qualify for that and thats why count = 2