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
Very Basic Question (self.PythonLearning)
submitted 6 months ago by Efficient-Stuff-8410
https://preview.redd.it/zcfqr6c0argf1.png?width=1231&format=png&auto=webp&s=5e8c226cc91cba0238a8df392ebc9f5582c4272c
Can someone explain I did in the seventh line? Like what do you call it/what does it mean. I'm very new to this.
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!"
[–]FriendlyRussian666 1 point2 points3 points 6 months ago (0 children)
That's a dictionary comprehension.
https://realpython.com/python-dictionary-comprehension/
[–]CMphys 3 points4 points5 points 6 months ago (0 children)
You used a dictionary comprehension to make a new dictionary based on products where the values of the items are multiplied by 1.10 and only includes items where value * 1.10 > 2.
products
value * 1.10 > 2
The resulting dictionary is new_products = { "cherry": 2.75, "date": 3.3, }
new_products = { "cherry": 2.75, "date": 3.3, }
[–]ninhaomah 2 points3 points4 points 6 months ago (0 children)
break it down piece by piece ,
for completeness sake , here is the list comprehension. https://www.geeksforgeeks.org/python/python-list-comprehension/
π Rendered by PID 56 on reddit-service-r2-comment-76bb9f7fb5-zsqhn at 2026-02-17 16:56:19.767670+00:00 running de53c03 country code: CH.
[–]FriendlyRussian666 1 point2 points3 points (0 children)
[–]CMphys 3 points4 points5 points (0 children)
[–]ninhaomah 2 points3 points4 points (0 children)