Skip to content

Instantly share code, notes, and snippets.

@AnisahTiaraPratiwi
Created March 23, 2021 06:48
Show Gist options
  • Save AnisahTiaraPratiwi/eccf39890c123cf2fd074e0102d8dc00 to your computer and use it in GitHub Desktop.
Save AnisahTiaraPratiwi/eccf39890c123cf2fd074e0102d8dc00 to your computer and use it in GitHub Desktop.
Question 5 The group_list function accepts a group name and a list of members, and returns a string with the format: group_name: member1, member2, … For example, group_list("g", ["a","b","c"]) returns "g: a, b, c". Fill in the gaps in this function to do that.
def group_list(group, users):
members =", ".join(users)
return "{}: {}".format(group, members)
print(group_list("Marketing", ["Mike", "Karen", "Jake", "Tasha"])) # Should be "Marketing: Mike, Karen, Jake, Tasha"
print(group_list("Engineering", ["Kim", "Jay", "Tom"])) # Should be "Engineering: Kim, Jay, Tom"
print(group_list("Users", "")) # Should be "Users:"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment