-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgodaddy domain finder
31 lines (26 loc) · 1.29 KB
/
godaddy domain finder
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
GoDaddy makes a lot of different top-level domains available to its customers.
A top-level domain is one that goes directly after the last dot ('.') in the domain name, for example .com in example.com.
To help the users choose from available domains, GoDaddy is introducing a new feature that shows the type of the chosen top-level domain.
You have to implement this feature.
To begin with, you want to write a function that labels the domains as "commercial", "organization", "network" or "information" for .com, .org, .net or .info respectively.
For the given list of domains return the list of their labels.
Example
For domains = ["en.wiki.org", "codesignal.com", "happy.net", "code.info"], the output should be
domainType(domains) = ["organization", "commercial", "network", "information"].
"""
#program---->
def domainType(domains):
list=[]
for i in domains:
x=i.split(".")
if x[-1] == 'com':
list.append('commercial')
elif x[-1]=='org':
list.append('organization')
elif x[-1]=='net':
list.append('network')
elif x[-1] =='info':
list.append('information')
print(list)
domainType(["com.net.info", "org.com.net", "net.com.org", "info.net.com", "net.net.com", "com.com.org", "info.info.net", "org.org.info"])