CodeSolved

Solved Programming Questions & Exercises

Separation of email sections

Practice Easy 40/ Download 2074 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 

22 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
class Email:
    def __init__(self,email):
        self.email = email
        self.username = ""
        self.domain = ""

    def emai(self):
        self.username,self.domain = self.email.split("@")
        return f"{self.username}\n{self.domain}"

email = input("enter your email =")
print(Email(email).emai())



Sumy.amiri Download Python
<< Previous page 1 2 3 Next page >>

Submit answer

Submitting answers is currently unavailable.

×
×
Close