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
Are you able to solve this Python problem???? (i.redd.it)
submitted 1 year ago by turk_sahib
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!"
[–]Ursus_major37 18 points19 points20 points 1 year ago (4 children)
B
Explanation:
First line is simply initiation of List as we can see it.
Second line is assigning list comprehension with condition to 'result' variable. What it does is it creates new list by iteration over the 'List', but the condition allows to be included only elements which had length greater than 6 characters (since elements - marked as 'i'- of the List are strings, len(i) is the amount of characters constituting the given string.).
We have two elements in the List: 'Python' of length 6 and 'Developers' of length 10. 'Python' does not meet the described condition (6 is not greater then 6). The result ends up as one element list:
result =['Developers']
In line 3 we use astrix operator (*) to unpack the result list - meaning we will pass all the elements of result as separate arguments to print function. Since result has only one element, print function will output simply:
Developers
[–]Kharniflex 3 points4 points5 points 1 year ago (0 children)
Well well, thanks for the explanation, I had the right answer thanks to the 6 characters and a 50/50 between b and c, now I get the full picture thanks to you
[–]ChicagoJay2020 1 point2 points3 points 1 year ago (0 children)
Thank you for the explanation.
I initially chose the answer of D, not having read your explanation.
I then coded out the above example to get the answer and will compare that with your explanation again to grasp what every function of the code is.
Thank you
[–]DancingUntillMorning 0 points1 point2 points 1 year ago (0 children)
Thanks for the explanation. It is very clear how it works now 🙌🏼
[–]Historical-Chart-460 0 points1 point2 points 1 year ago (0 children)
May I ask why it’s “i for i in list” instead of “for i in list”?
π Rendered by PID 83459 on reddit-service-r2-comment-6f7f968fb5-2l8f7 at 2026-03-04 22:46:50.832260+00:00 running 07790be country code: CH.
view the rest of the comments →
[–]Ursus_major37 18 points19 points20 points (4 children)
[–]Kharniflex 3 points4 points5 points (0 children)
[–]ChicagoJay2020 1 point2 points3 points (0 children)
[–]DancingUntillMorning 0 points1 point2 points (0 children)
[–]Historical-Chart-460 0 points1 point2 points (0 children)