Linked Questions

Popular Questions

How to make a generator of this cycle correctly?

I am a novice programmer, do not judge strictly, the Mentor asks me to write this cycle in one line

for post in posts:
    post_id_detail[post['id']] = post

I do this but it doesn't work

post = [post_id_detail[post['id']] for post in posts]

Help to make the right generator in one line

Related Questions