Question: PYTHON! PYTHON! PYHTON! Problem A. (5 points) Anonymizing Emails A common task for some web sites is that when someone is trying to verify information
PYTHON! PYTHON! PYHTON!
Problem A. (5 points) Anonymizing Emails
A common task for some web sites is that when someone is trying to verify information about their account, you show them some of their e-mail address, but not the entire thing because you dont want to give away information. Write a function anonymize(username, domain) that will help with this process.
The function will take two arguments, the e-mail username (the part before the @ character) and then the domain, (the rest, including the @ character.) Your function will return a string that is the first letter of the e-mail username, then 5 asterisk characters (regardless of the length of the username), then the last letter of the e-mail username, then the rest of the domain.
Hints:
-
To determine the last index of a string, you can use the len function.
-
Remember that you can concatenate two strings together using the + operator
Examples:
>>> anonymize("andy.exley", "@abc.com")
'a*****y@abc.com'
>>> anonymize("katherine_johnson", "@abc.org")
'k*****n@abc.org'
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
