Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation. it is a case-sensitive language. “Email Slicer“ is just a simple tool that will take multiple email address as input and slice it to produce the username and the domain associated with it. The email must be divided into two strings by using ‘@’ as the separator. So, the user provides n number of email addresses and you have to design logic to slice the username and the domain out of those email addresses. The domain part must print in capitals.
I have used the following functions to make this email slicer:
input():- This function helps in taking the input from a user and storing it in a variable. I have used this so that I can first ask the user if he or she wants to continue with the program and later take the email addresses.
If/else:- if is used to give a condition. The block of statement inside the ‘if’ works, only when the specified condition is true.I have used this to ask the user whether to continue with the program at first and then to see if the given email id is valid or not.
while:- With the while loop we can execute a set of statements as long as a condition is true. I have used the while function to make a list of the entered emails.
and:- Returns true if both statements are true.
not in:- In Python 'not in' membership operator evaluates to true if it does not finds a variable in the specified sequence and false otherwise.To check if the entered string contains ‘@’ or not.
list.append():- The append() method appends an element to the end of the list.Used it to make a list of entered emails
for:- A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).With the for loop we can executea set of statements, once for each item in a list, tuple, set, etc.used it To know the exact position of ‘@’, so we can know where to slice the string from