Question: Write a function that takes a username as input and replaces certain characters with digits or special characters that resemble them visually. However, replacements should
Write a function that takes a username as input and replaces certain characters with digits or special characters that resemble them visually. However, replacements should only be made on the even occurrence of those characters in the username, not the odd occurrences. In other words, the first time you see a character that can be replaced, we won't change it The second time you see a character that can be replaced, you should, and so on Note that the input will always be lowercased.
Arguments:
username type: str: The input username.
Returns:
fancyusername type: str: The modified username with replacements made.
Character Mappings:
a @
e
i
o
s $
g
b
Examples:
createfancyusernameusername: usrnam
createfancyusernameassociation: a$sci@tin
createfancyusernamemississippi: mi$ss$ipp
Starting code:
def createfancyusernameusername: str str:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
