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:30
Auniversity wants to install a client-server network. which feature do you think is important for them as they set up the network? sending email blocking multiple people to use the same file low security low set up cost limited access to files
Answers: 1
question
Computers and Technology, 22.06.2019 11:50
You have written, as part of a school assignment, a research paper on the solar system. you want to share this paper on your school website. on which type of server will you upload it?
Answers: 1
question
Computers and Technology, 24.06.2019 04:30
Write and test a python program to find and print the largest number in a set of real (floating point) numbers. the program should first read a single positive integer number from the user, which will be how many numbers to read and search through. after reading in all of the numbers, the largest of the numbers input (not considering the count input) should be printed.
Answers: 1
question
Computers and Technology, 25.06.2019 00:30
You are to write a series of steps that anyone could follow to solve the following three problems: 1. even odd a. assume that someone tells you a number (an integer number) b. you hear the number and respond with the word even or odd 2. average a. assume that someone tells you between 3 and 5 numeric values. b. you hear the numbers and respond with the average is some number 3. dog or cat a. explain to a child the differences between a dog and a cat. b. your explanation could be used by a child or anyone to distinguish the difference between a dog and a cat
Answers: 1
You know the right answer?
This problem is about Python modules.

Crate a module currency, which includes the follow...
Questions
question
History, 25.09.2020 19:01
question
Mathematics, 25.09.2020 19:01
Questions on the website: 13722362