Help with challenge: working with reddit api

Hello all,

Below I have attached two codes from the answer section. One is to find the most upvoted post and the other the most upvoted comment. For both codes, I am having difficulty understanding the for loop part. If someone could please explain it that would be greatly appreciated.

Thank you very much.

python_top_articles = python_top[‘data’][‘children’]
most_upvoted = ‘’
most_upvotes = 0
for article in python_top_articles:
ar = article[‘data’]
if ar[‘ups’] >= most_upvotes:
most_upvoted = ar[‘id’]
most_upvotes = ar[‘ups’]

comments_list = comments[1][‘data’][‘children’]
most_upvoted_comment = ‘’
most_upvotes_comment = 0
for comment in comments_list:
co = comment[‘data’]
if co[‘ups’] >= most_upvotes_comment:
most_upvoted_comment = co[‘id’]
most_upvotes_comment = co[‘ups’]

hey @chosum.tashi

In case you are still in doubt, you may check out this post. If you are able to grasp it great! If not do let us know, to help you further with this.