Question: can you write a python code to do this, In this assignment, we will read a CSV file from the web which contains conversion rates.
can you write a python code to do this, In this assignment, we will read a CSV file from the web which contains conversion rates. Based on user input
we will convert a given currency amount. You can use any of the collections we have discussed in class to solve the
problem.
Specifications
Create a module called userinput to handle user input and output.
Create a module to manage the collections of currencies finding populating, etc You should use a dict to
hold the currency information.
Prompt the user for the amount to be converted valid positive float DO NOT ASSUME the user will enter valid
data.
Prompt the user for the currency type: They can enter the Country, Currency, or Code and you may find more
than one match in the file. Make sure the comparison is case insensitive.
Make sure when you display the converted value, you show the original entered value, the calculated value, the
exchange rate, for all matches.
You will load the currencies from the following site:
o NOTE DO NOT download the file and include it in your file, read directly from the web.
o use website to get foreign currencyTest Cases
main
Enter the amount of currency
Invalid, try again
Enter the amount of currency
Enter the Country Name, Currency Name, or Currency Code shane
No matches found.
Process finished with exit code
main
Enter the amount of currency
Enter the Country Name, Currency Name, or Currency Code dinAR
Converting to the following currencies :
Kuwait rate of is Dinar KWD
Bahrain rate of is Dinar BHD
Jordan rate of is Dinar JOD
Tunisia rate of is Dinar TND
Libya rate of is Dinar LYD
Serbia rate of is Dinar RSD
Algeria rate of is Dinar DZD
Iraq rate of is Dinar IQD
Process finished with exit code
o NOTE You will need to get the URL for the most recent month!
o I would recommend opening the file in notepad so you can view the contents.
o NOTE: You can remove characters from a string using a slice.
NOTE: You can read from a website directly using:
o from urllib.request import urlopen
o file urlopenURL
o for line in file:
Do not forget the Python Docstring your grade will, in part, depend on the quality of these comments
Do not forget to put a comment with your name and assignment at the top of the file.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
