Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

To practice slicing and using string methods An email address is a sequence of characters with the following structure: it contains exactly one @ character

To practice slicing and using string methods
An email address is a sequence of characters with the following structure:
it contains exactly one @ character
there are 1 or more characters before the @. We call these characters the username
There is at least one period (.) SOMEWHERE after the @
IMMEDIATELY after the @ there are one or more characters that are NOT periods. We call all the
characters after the @ the fully qualified domain name (FQD), within the FQD there are zero or more
subdomains separated by periods, a domain before the last-period-after-the-@, and a top-level do-
main (i.e com, ca, etc) after the last period.
For this question, you will write a program that lets the user type in a valid email address, and reports the
username and the top-level domain components of that address. Your program may assume that the
user always types a correctly-formatted email address. You may also assume all top-level domains are no
longer than 3 characters.
Hint: Tools such as slicing, negative indexing, and the string method .find() will probably be the most
useful here.
Sample Runs
Here is one possible sample run. Green text was entered by the user, and the blue text is based on that
input.
Enter email address : ash@pokemon.kanto.jp
Username : ash
First Subdomain / Domain : jp
Here is another one.
Enter email address : jeff.long@usask.ca
Username : jeff.long
First Subdomain / Domain : ca

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions

Question

Find the vertical asymptote for the equation H(x) = -3/x+2

Answered: 1 week ago

Question

Write short notes on Interviews.

Answered: 1 week ago

Question

Define induction and what are its objectives ?

Answered: 1 week ago

Question

Discuss the techniques of job analysis.

Answered: 1 week ago

Question

How do we do subnetting in IPv6?Explain with a suitable example.

Answered: 1 week ago