Answer:
Python Code:
def validate_url(url):
#Creating the list of valid protocols and file name extensions
valid_protocols = ['http', 'https', 'ftp']
valid_fileinfo = ['.html', '.csv', '.docx']
#splitting the url into two parts
url_split = url.split('://')
isProtocolValid = False
isFileValid = False
#iterating over the valid protocols and file names for validity
for x in valid_protocols:
if x in url_split[0]:
isProtocolValid = True
break
for x in valid_fileinfo:
if x in url_split[1]:
isFileValid = True
break
#Returning the result if the URL has both valid protocol and file extension
return (isProtocolValid and isFileValid)
url = input("Enter an URL: ")
print(validate_url(url))
Explanation:
The image of the output code is attached. Hope it helps.
Answer:
a. The network will not satisfy the customers because the required addresses is 128 but what can be offered is 126.
b. 195.200.0.0/22
Explanation:
195.200.0.0/16
The number of bits to give 512 is 9
2^9=512
2^8=256 which is not up to our expected 320 customers that requires a network ip
Note we have to use a bit number that is equal or higher than our required number of networks.
The number of host per each subnet of the network (195.200.0.0/25) is (2^7)-2= 128-2=126
The network will not satisfy the customers because the required addresses is 128 but what can be offered is 126.
b. 64 customers requires 6 bits to be taken from the host bit to the network bit
i.e 2^6 = 64
195.200.0.0/22
The number of host per each subnet of the network (195.200.0.0/22) is (2^10)-2=1024 - 2 = 1022 hosts per subnet
This network meet the requirement " 64 customers want 128 addresses/customer "
Answer: Supermarket bar code scanners and Voice-activated telephone menus are not instances of artificial intelligence
Explanation:
(a)Supermarket bar code scanners are only able to read the code however they are not able to perform any kind of machine learning techniques to be able to learn a sequence from the codes. As machine learning is a important part of artificial intelligence (AI) so they are not instances of AI. Similarly for Voice-activated telephone menus they could only display and cannot perform any intelligent task.
Web search engines and Internet routing algorithms are very dynamic and intelligent in processing and retrieving information to the end user.
So they are instances of AI.
Answer:
<u>Explanation:</u>
An input statement using the input function at the shell prompt is as follows:
If a prompt asks for a input, a number is to be added
num = input ('Number: ')
num = num + 1
print(num)
Explanation of results: This gives error at line num= num + 1 as cannot convert int object to str implicitly