Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started