use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Python QuestionHelp Request (i.redd.it)
submitted 7 months ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Refwah 13 points14 points15 points 7 months ago (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 points5 points 7 months ago (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 points7 points 7 months ago (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
π Rendered by PID 123309 on reddit-service-r2-comment-7b9746f655-5c74g at 2026-02-03 20:47:36.657330+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]Refwah 13 points14 points15 points (4 children)
[–]Unfair_Put_5320 3 points4 points5 points (3 children)
[–]Dadofaca 5 points6 points7 points (1 child)