Question: Hi, I would be grateful for some help with the questions below. Let me know if I need to send extra info. Thanks (a) What
Hi, I would be grateful for some help with the questions below. Let me know if I need to send extra info. Thanks
(a) What is the purpose of each of the following lines? #!/usr/bin/python3 import string, httplib2 What is achieved by having these in the program? (6 marks) (b) What is the purpose of the following code. ? 1 W249/607 if __name__ == __main__:
main ()
(c) What is the purpose of the try ... except block? What does this achieve in the context of the overall program?
(d) Consider the following lines h = httplib2.Http(".cache") speech_headers, speech = h.request(SPEECH_URL) stopwords_headers, stopwords = h.request(STOPWORDS_URL) (i) What is the purpose of ".cache"? (ii) If the request method returned a status of 304 in its Response object, what would this mean? Is it helpful or useful? (iii) The request method returns two objects. One is a Response object. What is the data type of the other? Briefly outline, in the context of the program, what you would need to do to the speech object to make it useful after it has been created in the line speech_headers, speech = h.request(SPEECH_URL) (e) Why are the variables, SPEECH URL and STOPWORDS URL written in uppercase text?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
