CodeSolved

Solved Programming Questions & Exercises

Separation of email sections

Practice Easy 40/ Download 1690 Views

Write a program that receives an email address and separates the various sections as follows and prints on the output

Example:

email: info@amirhn.ir
info
amirhn.ir

Example:

email: username@gmail.com
username
gmail.com 

19 Answers

This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
username, domain = input('Email:').strip().split('@')
print(f'{username}{"\n"}{domain}')
User 251 Download Python
email = input("enter email: ")
username, domain = email.split("@")
print(f"{username}\n{domain}")
def split_email(email):
    try:
        username, domain = email.split('@')
        return username, domain
    except ValueError:
        return "email na motabar"
email = input("email: ")
result = split_email(email)
if isinstance(result, tuple):
    print(f"username: {result[0]}")
    print(f"damin: {result[1]}")
else:
    print(result)
email=input("please enter your email: ")
atsinChar=email.find("@")
print(email[:atsinChar])
print(email[atsinChar+1:])
Saeeda33 Download Python
i = input("Enter Email :")
f = i.find("@")
s = i[:f]
s2 = i[f+1:]
print(f"Email Shom:{i}\n User Email Shoma:{s}\n Damein Email Shoma:{s2}")
Programmer Download Python
e = str(input("mail: "))
a = e .find("@")
print(e[:a])
print(e[(a + 1):])
Esmaeelphy Download Python
# In this e -mail code the user is taken
email = input('enter email: ')

find = email.find('@')

if find == -1: # This section of the code also examines the correct email entered
    print('Please enter the correct email.')
else: # If the correct email is entered, prints before Mathin and after Metsin
    print(email[:find])
    print(email[find:])
Amirsaleh Download Python
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

×
×
Close