Menu
support@nursinghomework.org
+1 714-215-3097

(Solved) : Wikipedia Article Help Read Input Write Output Python 2 Click Challenge Use Http Get Meth Q35623836

☆ Wikipedia Article For help on how to read input and write output in Python 2, click here. In this challenge, use an HTTP GE

☆ Wikipedia Article For help on how to read input and write output in Python 2, click here. In this challenge, use an HTTP GET method to retrieve information from Wikipedia. Query https://en.wikipedia.org/w/api.php?action-parse&section=0&prop=text&format-json&page= topicj to get the topic Wikipedia article. Print the total number of times that the string [topic appears in the article’s text field. Note that the search is case-sensitive. Original Code Python 2 1 #l/bin/python # Complete the function below #https://en.wikipedia.org/w/api.php?action-parse&section-0&prop-text& format-ison&page [topic 10 The query response from the website is a JSON object described below: parse: A JSON object representing the article’s parsed web page. It has the following three fields: title: The article’s title, as specified by the argument passed as topic. pageid: The article’s Page ID. text: A JSON object that contains the Wikipedia article as an HTML dump. 12 def getTopicCount (topic): 13 14 Bfopen(os.environ[ ‘OUTPUT PATH 15 16 17 try: 18 19 except: 20 topic -raw_input() Function Description Complete the function getTopicCount in the editor below. The function must print an integer, the number of times the search term topic appears in the returned text field. topic None 22 res getTopiccount(_topic) 23 .write(str(res) “n) 24 25 f.close() 26 getTopicCount has the following parameter(s): topic: a string to query Input Format for Custom Testing Sample Case 0 Show transcribed image text ☆ Wikipedia Article For help on how to read input and write output in Python 2, click here. In this challenge, use an HTTP GET method to retrieve information from Wikipedia. Query https://en.wikipedia.org/w/api.php?action-parse&section=0&prop=text&format-json&page= topicj to get the topic Wikipedia article. Print the total number of times that the string [topic appears in the article’s text field. Note that the search is case-sensitive. Original Code Python 2 1 #l/bin/python # Complete the function below #https://en.wikipedia.org/w/api.php?action-parse&section-0&prop-text& format-ison&page [topic 10 The query response from the website is a JSON object described below: parse: A JSON object representing the article’s parsed web page. It has the following three fields: title: The article’s title, as specified by the argument passed as topic. pageid: The article’s Page ID. text: A JSON object that contains the Wikipedia article as an HTML dump. 12 def getTopicCount (topic): 13 14 Bfopen(os.environ[ ‘OUTPUT PATH 15 16 17 try: 18 19 except: 20 topic -raw_input() Function Description Complete the function getTopicCount in the editor below. The function must print an integer, the number of times the search term topic appears in the returned text field. topic None 22 res getTopiccount(_topic) 23 .write(str(res) “n) 24 25 f.close() 26 getTopicCount has the following parameter(s): topic: a string to query Input Format for Custom Testing Sample Case 0

Leave a Reply

Your email address will not be published. Required fields are marked *