subject
Computers and Technology, 20.03.2020 01:25 cavapoo

This problem is about Python modules.

Crate a module currency, which includes the following three functions that do currency conversions:

to_euro(dollar): This function receives US Dollar as an argument and converts it to Euro. 1 US Dollar = 0.81 Euro. Return Euro.

to_yen(dollar): This function receives US Dollar as an argument and converts it to Japanese Yen. 1 US Dollar = 106.45 Yen. Return Yen.

to_peso(dollar): This function receives US Dollar as an argument and converts it to Mexican Peso. 1 US Dollar = 18.58 Peso. Return Peso.

Store these three functions in a file named currency. py.

Create a file for the main module. Name the file lab12P2.py.

Define a main function in the main module to do the following:

Ask the user to choose a foreign currency: Euro, Japanese Yen or Mexican Peso.

Write a loop to validate user input. If an invalid choice is made, display an error message and ask the user to choose a foreign currency again until the choice is valid.

Ask the user to enter US dollar amount. Write a loop to validate user input. If the US dollar amount is negative, display an error message and ask the user to reenter it until it is non-negative.

Call one of the three functions in the currency module to convert US dollar to the foreign currency chosen by the user

Receive and display the converted foreign currency

The following is an example.

Converting US Dollar to a foreign currency.

Enter 1 for Euro, 2 for Japanese Yen, 3 for Mexican Peso: 4

Error: Invalid Choice

Enter 1 for Euro, 2 for Japanese Yen, 3 for Mexican Peso: 5

Error: Invalid Choice

Enter 1 for Euro, 2 for Japanese Yen, 3 for Mexican Peso: 2

Enter US Dollar: -100

Error: US Dollar cannot be negative.

Enter US Dollar: -200

Error: US Dollar cannot be negative.

Enter US Dollar: 100

It is converted to 10645.0 Yen

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:10
3. bob is arguing that if you use output feedback (ofb) mode twice in a row to encrypt a long message, m, using the same key each time, it will be more secure. explain why bob is wrong, no matter what encryption algorithm he is using for block encryption (15 points).
Answers: 3
question
Computers and Technology, 24.06.2019 16:00
Read these lines from beowulf.often scyld scefing seized mead-benches from enemytroops, from many a clan, he terrified warriors, even thoughfirst he was found a waif, best explains why the author includes this information in theexposition? a. to emphasize that a hero must learn to be fierceb. to remember the famous story of a popular heroc. to express sadness about losing the old heroesd. to see whether people still respect the old heroes
Answers: 1
question
Computers and Technology, 25.06.2019 00:00
Into which of these files would you paste copied information to create an integrated document? a. mailing list b. destination c. source d. data source
Answers: 1
question
Computers and Technology, 25.06.2019 12:00
Fill in the blank; "as well as their traditional role of computing data, computers are also extensively used "
Answers: 3
You know the right answer?
This problem is about Python modules.

Crate a module currency, which includes the follow...
Questions
question
Chemistry, 12.04.2021 14:00
question
Arts, 12.04.2021 14:00
question
World Languages, 12.04.2021 14:00
Questions on the website: 13722363