Question: The groups _ per _ user function receives a dictionary, which contains group names with the list of users. Users can belong to multiple groups.
The groupsperuser function receives a dictionary, which contains group names with the list of users. Users can belong to multiple groups. Fill in the blanks to return a dictionary with the users as keys and a list of their groups as values.
def groupsperusergroupdictionary :
usergroups
# Go through groupdictionary
for group, users in groupdictionary.items:
# Now go through the users in the group
for user in users:
# Now add the group to the the list of
# groups for this user, creating the entry
# in the dictionary if necessary
returnusergroups
print groupsperuserlocal: admin "userA"
"public": admin "userB"
"administrator": admin
Reset
Error on line :
returnusergroups
IndentationError: expected an indented block
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
