Created
March 23, 2021 06:48
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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