Question: The count_users function recursively counts the amount of users that belong to a group in the company system, by going through each of the members

 The count_users function recursively counts the amount of users that belong

The count_users function recursively counts the amount of users that belong to a group in the company system, by going through each of the members of a group and if one of them is a group, recursively calling the function and counting the members. But it has a bug! Can you spot the problem and fix it?

1 - def count_users (group) : 2 count = 3- for member in get_members(group) : count += 1 5 if is group (member): count += count_users(member) 7 return count Ejecutar print(count_users (sales")) #Should be 3 print(count_users ("engineering")) # Should be 8 print(count users("everyone")) # Should be 18 Restablecer 11

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!