Part 2: Currency Exchange Table Look Up

Part 2: Currency Exchange Table Look Up

In order to calculate the transactions in the later sections, you need to access the currency exchange information. The currency exchange rate table can be found in URL: https://www.cs.purdue.edu/homes/jind/exchangerate.html. In order to access the information, you need to implement a basic web crawler. For this project, your crawler only need to collect currency exchange rate information.
The first thing your crawler should do is to specify the URL you would like to fetch. Then use an URL open function with this request object to return a response object for the URL requested. This response is a file-like object, which means you can call functions such as .read() on the response. Further, it is known that the dominant character encoding for the World Wide Web is UTF-8. Use this registered codec for decoding. To be more specific, you need to define:

#helps fetch currency information from the currency table
#PARAMETERS:
#url: specifies the url you are trying to fetch, type: string, example: “http://www.google.com”
#RETURN: currency information list, type: nested list
def fetch(url):
#Create request object and get web content by given url

#Read the currency exchange table and put the information in a nested list called, e.g. records

#Each element in records will contain the currency name and a list of the exchange rate between USD
#The sublist includes the rate stored in the first column, and the rate stored in the second column of the webpage table
#i.e., records = [[‘Argentine Peso’, [9.44195, 0.10591]], [‘Australian Dollar’, [1.41824, 0.7051]], …]

#In the end, fetch() should return records
#Return records

Unlike most other websites we deliver what we promise;

  • Our Support Staff are online 24/7
  • Our Writers are available 24/7
  • Most Urgent order is delivered with 6 Hrs
  • 100% Original Assignment Plagiarism report can be sent to you upon request.

GET 15 % DISCOUNT TODAY use the discount code PAPER15 at the order form.

Type of paper Academic level Subject area
Number of pages Paper urgency Cost per page:
 Total: