Problem 113952 · easy · Phase 01 Prerequisites & Setup

Split an Email Address

strings · find · slicing · tuples

Given an email address email that contains exactly one @, return a tuple (user, domain) with the part before the @ and the part after it.

Examples

Input:  email = "ada@example.com"
Output: ("ada", "example.com")

Input:  email = "@nd.edu"
Output: ("", "nd.edu")

Constraints

  • 1 <= len(email) <= 200
  • email contains exactly one @ and otherwise letters, digits, dots, dashes and underscores

Goals

  • Locate a character with `find` or `index`
  • Slice around that position
  • Return two values as a tuple
Starting Python…