H Study Guide - Quiz Guide: Parsing

7 views2 pages

Document Summary

A valid email address meets the following criteria: It"s composed of a username, domain name, and extension assembled in this format: username@domain. extension. The username starts with an english alphabetical character, and any subsequent characters consist of one or more of the following: alphanumeric characters, -,. , and _. The domain and extension contain only english alphabetical characters. The extension is 1, 2, or 3 characters in length. Given n pairs of names and email addresses as input, print each name and email address pair having a valid email address on a new line. Hint : try using email. utils() to complete this challenge. For example, this code: import email. utils print email. utils. parseaddr("doshi ") print email. utils. formataddr(("doshi", "doshi@hackerrank. com")) produces this output: ("doshi", "doshi@hackerrank. com") The first line contains a single integer, n, denoting the number of email address. Each line i of the n subsequent lines contains a name and an email address as two space-separated values following this format: name

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers

Related Documents