Answered step by step
Verified Expert Solution
Link Copied!

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 groups_per_user 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 groups_per_user(group_dictionary) :
user_groups ={}
# Go through group_dictionary
for group, users in group_dictionary.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
return(user_groups)
print (groups_per_user({"local": ["admin", "userA"],
"public": ["admin", "userB"],
"administrator": ["admin"]}))
Reset
Error on line 11:
return(user_groups)
IndentationError: expected an indented block
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Explain the function of sensory adaptation.

Answered: 1 week ago