Description
Suppose the ABC Bank needs an application that converts American dollars to British
pounds, Mexican pesos, Canadian dollars, and Japanese yen. The currency conversion rates
are as follow:
1 US dollar = 0.62 British pounds
1 US dollar = 13.14 Mexican pesos
1 US dollar = 1.10 Canadian dollars
1 US dollar = 105.98 Japanese yen
Write a complete Python script that takes the amount in American dollars from user and
display that amount in British pounds, Mexican pesos, Canadian dollars, and Japanese yen.
Save your script as “PA1_Question1.py” in cs104PA1 folder. The user interface of your
script may look like as follows:
Important:
NO LATE ASSIGNMENT WILL BE ACCEPTED without a valid reason.
Feel free to talk to the instructor or a TA if you need any help to complete the assignments.
SOLUTIONS SHOULD BE ORIGINAL AND INDEPENDENTLY DEVELOPED. No consultation
of other people’s solutions is permitted. No sharing of answers is permitted. Assistance by others
(except the instructor or TAs) must be specifically credited in the solution to the problem that is
turned in, describing what the contribution was (e.g., “Thanks to [name] for explaining the
difference between AND and OR gates in Checkpoint 4”, not “Thanks to [name] for help with Lab
Assignment 1.”). Any evidence of plagiarizing will result ZERO points.
Please start the programming assignment as soon as possible and get your questions answered early!
2
Unit Conversion
Write a complete Python script that asks the users from which unit they want to convert
(only gal, lb and mi) and to which unit they want to convert (only l, kg and km). Reject
incompatible conversions such as gal → km. For a valid conversion, take a value to convert
and display the result. Save your script as “PA1_Question2.py” in cs104PA1 folder.
The valid unit conversions are as follow:
Convert From Convert To
1 gal (1 gallon) 3.78541 l (3.78541 liters)
1 lb (1 pound) 0.45359 kg (0.45359 kilogram)
1 mi (1 mile) 1.60934 km (1.60934 kilometer)
Hints: You may follow the steps shown in the flowchart given below.
Continue on next page…
3
The user interface of your script may look like as follows (Values in black are user input):
Case 1:
Case 2:
Documentation and style
Up to 10% of the points will be for documentation and style.
The file should begin with a descriptive comment explaining what it is for
Use meaningful names for variables
Use helpful prompts when asking the user to enter values
Provide a meaningful description as part of the output
Do not worry about formatting the number of decimal places in the output.
Submission
Submit a zip file containing ONLY the files PA1_Question1.py and PA1_Question2.py via
the Programming Assignment 1 Submission link in Blackboard.