[Tutor] Input is Dictionary1, Output is Dictionary2 (using keys and values of Dictionary1)
Mark Lawrence
breamoreboy at gmail.com
Thu Jan 30 18:52:37 EST 2020
On 30/01/2020 20:23, Panchanathan Suresh wrote:
> Hi Everyone,
>
> I spent a lot of time on this, trying out many things, but I am unable to
> create a new dictionary with the users as keys and a list of their groups
> as values.
>
> Input Dictionary is {"local": ["admin", "userA"],"public": ["admin",
> "userB"],"administrator": ["admin"] }
> Expected Output Dictionary is {"userA": ["admin","public"], "userB":
> ["admin"], "administrator": ["admin"]}
>
I have no idea what you're trying to achieve as your input key "local"
doesn't appear in the output, your "public" key does and the
"administrator": ["admin"] key/value pair appears in both.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Tutor
mailing list