Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement the function domain_type () in domain_type.py that returns the domain

ID: 3818691 • Letter: I

Question

Implement the function domain_type () in domain_type.py that returns the domain type of the URL specified as argument. For example, the domain type of the URL http://www.swamiiyer.net/cs110/is net. You may assume that the URL starts with 'http://' and ends with '/'. $ python domain_type. py http://www.pythonhmwk.net/net import stdio import sys # Returns the domain type of the given URL. def domain_type(URL): # Test client [DO NOT EDIT]. Reads a URL as command-line argument and writes # its domain type. def _main(): URL = sys.argv[1] stdio.writeln(domain_type(URL)) if)__name___= = ' _main____': ___main()

Explanation / Answer

import sys

def domain_type(temp):
   temp = sys.argv[1]
   split1 = temp.split('/');
   split2 = split1[2].split('.')
   return split2[2]