We take a small task of slicing out the username and domain name from an email address. We ask the user to type his email address. We take his email address and slice out first his username and then the domain name of the user. Then we display his username and the domain name after formatting the message.This small program can be written in Python very easily. Lets python this task below:
#get user email address
email = input("what is your email address? ").strip()
#slice out username
user =email[:email.index("@")]
#slice out the domain name
domain = email[email.index("@")+1:]
#format message
output = "Your username is {}and your domain name is {}".format(user,domain)
#display output message
print(output)