Q. Write a program to read email IDs of n number of students and store them in a tuple. Create two new tuples, one to store only the usernames from the email IDs and second to store domain names from the email IDs. Print all three tuples at the end of the program.
[Hint: You may use the function split() ]
Answer :-
tup = eval( input ("Enter a tuple containing n email id's of student :-")) tupuser = () tupdomain = () for i in tup : lst = i.split("@") tupuser += ( lst[0] ,) tupdomain += ( lst[1] , ) print(tup) print("User name tuple :-", tupuser ) print("Domain tuple :-", tupdomain )
Output :-
Enter a tuple containing n email id's of student :-("pathwalla@gmail.com","computerportal@yahoo.com","portalexpress@info.com")
('pathwalla@gmail.com', 'computerportal@yahoo.com', 'portalexpress@info.com')
User name tuple :- ('pathwalla', 'computerportal', 'portalexpress')
Domain tuple :- ('gmail.com', 'yahoo.com', 'info.com')
>>>
Good
ReplyDeleteThank you 😊❣️
Deletewelcome
ReplyDelete: )
Deletethanks
ReplyDeleteWelcome : )
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )