Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due
DS2001 Week 3
Question 1. Foreign Currency Exchange
You will be working with 3 text files: usd_to_cad.txt, usd_to_euro.txt, and usd_to_gbp.txt. Each file contains the exchange rate of 1 US dollar to a foreign currency (CAD, Euro, and GBP).
· The first line of each file contains the name of the foreign currency.
· The subsequent lines represent the exchange rates for four consecutive days (Day 1 to Day 4).
Your task:
Answer the following questions. Be sure to add comments in your code to explain your logic.
1. Read the data from these files and save the information using different variables. Use the variables to display the name of each foreign currency from the files (1 point).
2. What is the highest exchange rate of 1 US dollar for each foreign currency? What is the lowest exchange rate of 1 US dollar for each foreign currency? (0.5 point)
3. Difference in Exchange Rates: What is the difference between the highest and lowest exchange rates of 1 US dollar for each foreign currency? Round your answer to 3 digits. (0.5 point)
Hint: Your answer for the above 3 questions should look like this:
4. Create 3 separate graphs to visualize the exchange rate trends of 1 US dollar to each foreign currency (CAD, Euro, and GBP) over time (1.5 point. 0.5 point for each graph).
Requirements:
· X-axis: Represents the day (Day 1, Day 2, Day 3, and Day 4).
· Y-axis: Represents the exchange rate (the value of 1 US dollar in the foreign currency).
Plot Specifications:
· Colors:
o Red for CAD
o Blue for Euro
o Green for GBP
· Markers: Choose your own marker style (e.g., circles, triangles) to represent each data point.
· Labels:
o Label the x-axis as "Day".
o Label the y-axis as "Exchange Rate".
· Titles: Add a descriptive title to each plot (e.g., "USD to CAD Exchange Rate Over Time").
·
Hint: Your graphs should look like this:
Question 2. U.S. Population with College Degree by Gender
You are provided with two files, “college_male.txt” and “college_female.txt”, which contain the percentage of the U.S. population with a college degree for different years. The files are organized as follows:
· The first line represents data for 1980.
· The second line represents data for 1990.
· The third line represents data for 2000.
· The fourth line represents data for 2010.
· The fifth line represents data for 2020.
Your task:
1. Read the data from both files and save the information using different variables (0.5 point).
2. Plot the data for both males and females on the same graph (0.5 point):
o Use Red to represent males.
o Use Green to represent females.
o Choose your own markers (e.g., circles, triangles, etc.) for each data point.
3. Add the following to your graph (0.5 point):
o A legend to distinguish between male and female data.
o Label the x-axis as "Year" and the y-axis as "Percentage".
o A descriptive title for the graph, such as "Percentage of the U.S. Population with a College Degree by Gender."
Hint: Your graph should look like this: