← Back to challenges

Retrieve Name from Email Address

PythonHardlogicstrings

Instructions

Create a function that takes an email address and returns the name in the address.

  • The "name" is the letters/alphabetical characters before the @ in the address.
  • The "name" will not always be an actual name.
  • Email addresses will end in something like @domain.com

Examples

get_name("[email protected]") ➞ "yourname"

get_name("[email protected]") ➞ "john"

get_name("[email protected]") ➞ "pamelaCole"

get_name("[email protected]") ➞ "Chickenlololol"

Notes

  • Keep the original capitalization in the email address.
  • All email addresses are purely made-up. It is a coincidence if any of the test email addresses actually exists.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.