Skip to content

Instantly share code, notes, and snippets.

@AnisahTiaraPratiwi
Created March 23, 2021 09:01
Show Gist options
  • Save AnisahTiaraPratiwi/54b5ced811911a71e7bd8ab4876ae286 to your computer and use it in GitHub Desktop.
Save AnisahTiaraPratiwi/54b5ced811911a71e7bd8ab4876ae286 to your computer and use it in GitHub Desktop.
The email_list function receives a dictionary, which contains domain names as keys, and a list of users as values. Fill in the blanks to generate a list that contains complete email addresses (e.g. [email protected]).
def email_list(domains):
emails = []
for domain, users in domains.items():
for user in users:
emails.append("{}@{}".format(user, domain))
return(emails)
print(email_list({"gmail.com": ["clark.kent", "diana.prince", "peter.parker"], "yahoo.com": ["barbara.gordon", "jean.grey"], "hotmail.com": ["bruce.wayne"]}))
Copy link

ghost commented May 3, 2021

thank You. this really helped.

@alexakeli
Copy link

Thank you. This is helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment