RESTRICTIONS, PLEASE READ: Do it on python and do not add any imports.Do not use try-except statements. def find_email(s: str) -> str:     """     Given a string , return the email that exists in the string.     Preconditions:         contains at most 1 email, or none at all.     If does not contain an email, return the empty string.     Email definition:         An email address is defined as 'name@domain.com' or 'name@domain.ca'         with the following specifications:             name: the name is an alphanumeric string that is less than or                   equal to 12 characters. Additional characters allowed are                   dash (-), period (.) and underscore (_). But the email                   cannot start or end with these additional characters.                   The name must also be at least 1 character long.                   Example names:                                 a                                 ab                                 a_b                                 A__B..C--D                                 1nt3r3st.1ng             domain: the domain is strictly numerical, and the number must be                     divisible by 5. the length of the domain is unrestricted.                     Example domains:                                 984125                                 0             ending: the email must end with a (.com) or (.ca) (case sensitive)     Note: you must not use any loops (for, while) here.           We want you to just use the re library for this function.     >>> find_email('12345a_test_email@165265365.com!')     'a_test_email@165265365.com'     """

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

RESTRICTIONS, PLEASE READ:
Do it on python and do not add any imports.Do not use try-except statements.

def find_email(s: str) -> str:
    """
    Given a string <s>, return the email that exists in the string.

    Preconditions:
        <s> contains at most 1 email, or none at all.

    If <s> does not contain an email, return the empty string.

    Email definition:
        An email address is defined as 'name@domain.com' or 'name@domain.ca'
        with the following specifications:

            name: the name is an alphanumeric string that is less than or
                  equal to 12 characters. Additional characters allowed are
                  dash (-), period (.) and underscore (_). But the email
                  cannot start or end with these additional characters.
                  The name must also be at least 1 character long.
                  Example names:
                                a
                                ab
                                a_b
                                A__B..C--D
                                1nt3r3st.1ng

            domain: the domain is strictly numerical, and the number must be
                    divisible by 5. the length of the domain is unrestricted.
                    Example domains:
                                984125
                                0

            ending: the email must end with a (.com) or (.ca) (case sensitive)

    Note: you must not use any loops (for, while) here.
          We want you to just use the re library for this function.

    >>> find_email('12345a_test_email@165265365.com!')
    'a_test_email@165265365.com'
    """

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Program on Numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education