employer cover photo
employer logo

Pergunta de entrevista da empresa PromptWorks

How would you read in a tuple of key-value pairs into a dict in Python?

Resposta da entrevista

Sigiloso

6 de mar. de 2018

I described a mutation-y way to do it (iterate over tuple in a loop and set value in dict) because I couldn't remember exactly how to do it without mutation, though I knew there was an easy way to do it (turns out you can just pass it directly into `dict`). That was good enough for them.