answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
TEA [102]
2 years ago
11

The groups_per_user function receives a dictionary, which contains group names with the list of users. Users can belong to multi

ple 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 ___:
# Now go through the users in the group
for ___: # 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"] }))
Computers and Technology
1 answer:
Akimi4 [234]2 years ago
3 0

The groups_per_user function receives a dictionary, which contains group names with the list of users.

Explanation:

The blanks to return a dictionary with the users as keys and a list of their groups as values is shown below :

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

         user_groups[user] = user_groups.get(user,[]) + [group]

   return(user_groups)

print(groups_per_user({"local": ["admin", "userA"],

       "public":  ["admin", "userB"],

       "administrator": ["admin"] }))

You might be interested in
Which one of the following is the best example of an authorization control? (a)- Biometric device (b)- Digital certificate (c)-A
DedPeter [7]

Answer:

A

Explanation:

Biometric device is the best example of authorization / identify control.

7 0
2 years ago
Implement the function couple, which takes in two lists and returns a list that contains lists with i-th elements of two sequenc
In-s [12.5K]

Answer:

couple.py

def couple(s1,s2):

  newlist = []

  for i in range(len(s1)):

      newlist.append([s1[i],s2[i]])

  return newlist

s1=[1,2,3]

s2=[4,5,6]

print(couple(s1,s2))

enum.py

def couple(s1,s2):

  newlist = []

  for i in range(len(s1)):

      newlist.append([s1[i],s2[i]])

  return newlist

def enumerate(s,start=0):

  number_Array=[ i for i in range(start,start+len(s))]

  return couple(number_Array,s)

s=[6,1,'a']

print(enumerate(s))

print(enumerate('five',5))

Explanation:

7 0
2 years ago
What will be the output of the following Python code? class A: def test1(self): print(" test of A called ") class B(A): def test
Vlad [161]

Answer:

"test of B called"

Explanation:

  • The object is created for the D class, but there are two test methods in class B and C.
  • The D class does not hold any test method. So when the object called the test method. Then the B method is called.
  • It is because the B class is declared first in the inheritance of D class like in the statement "class D(B, C)".
  • If the statement will be "class D(C, B)", then the C method will be called.
  • if the D class holds the method test, then only the D method will be called.
  • Hence the output is "test of B called".
7 0
2 years ago
1)When the liquid is spun rapidly, the denser particles are forced to the bottom and the lighter particles stay at the top. This
Delvig [45]

Answer:

Centrifugation.

Explanation:

When the liquid is spun rapidly, the denser particles are forced to the bottom and the lighter particles stay at the top. This principle is used in centrifugation.

Centrifugation can be defined as the process of separating particles from a liquid solution according to density, shape, size, viscosity through the use of a centrifugal force. In order to separate these particles, the particles are poured into a liquid and placed in a centrifuge tube. A centrifuge is an electronic device used for the separation of particles in liquid through the application of centrifugal force. Once the centrifuge tube is mounted on the rotor of the centrifuge, it is spun rapidly at a specific speed thereby separating the solution; denser particles are forced to the bottom (by moving outward in the radial direction) and the lighter particles stay at the top as a result of their low density.

6 0
2 years ago
Some numbers are formed with closed paths. the digits 0, 4, 6 and 9 each have 1 closed path and 8 has 2. None of the other numbe
postnew [5]

Answer:

def cal(n):

s=0

while n>0:

r=n%10

if(r==0 or r==4 or r==6 or r==9):

s=s+1

elif r==8:

s=s+2

n=n//10

print(s)

n=int(input("enter number:"))  

print(n)

cal(n)

Explanation:

  • Create a function to calculate count of closed path .
  • Create a variable to store count of closed path .
  • While number is positive , extract last digit of n .
  • Reduce number by truncating last digit .
  • Make a function call to compute count of path.
5 0
2 years ago
Other questions:
  • Which statement best describes how the rapid prototyping model works?a) Developers create prototypes to show stakeholders how va
    11·2 answers
  • Ivan has five workbooks open. He has arranged these files in a specific grouping so he can view them at the same time. In order
    10·1 answer
  • Identify the normalized form of the mantissa in 111.01.
    14·1 answer
  • Which term describes a process by which malicious code can enter from a non-secure network, and make a hairpin, or sharp turn, a
    6·1 answer
  • When configuring a record type, an App Builder can configure the available value of a picklist field for the page layout. Which
    9·1 answer
  • Suppose that, even unrealistically, we are to search a list of 700 million items using Binary Search, Recursive (Algorithm 2.1).
    11·1 answer
  • Make a class Employee with a name and salary. Make a class Manager inherit from Employee. Add an instance variable, named depart
    14·1 answer
  • Python
    9·1 answer
  • Your company is developing a new marketing campaign and wants to know which customers have never placed an order. You will need
    10·1 answer
  • Three variables , x, y and z, supposedly hold strings of digits, suitable for converting to integers. Write code that converts t
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!