Write a program that demonstrates the use of user-defined

Assignment Help Other Subject
Reference no: EM133731938

Assignment Requirements

In this assignment, you will write a program that demonstrates the use of user-defined modules by invoking functions from imported modules. Your program will accept a distance value and unit of length (miles or kilometers) and will call functions within your user-defined modules to convert the distance to the other unit of length. You will create two modules that contain the functions: one to convert miles to kilometers and one to convert kilometers to miles. Your program should continue converting entered distances until the user chooses to discontinue the program.

Assignment Directions

You will begin by creating the modules that hold the conversion functions. Start a new Python file and build each function to do the appropriate conversions.

Create a module named miles.

Create a function within this module named convertToMiles that accepts one value and returns the converted value when called.

Next you will create your Python program to accept user input of a distance value and unit of length (miles or kilometers). You will start by including the import statements at the top of this program. You will import both the miles and kilometers modules you just created.Reminder: These three Python files must exist within the same directory.Reference: Refer to Programming in Python Chapter 7: Python Modules / 7.2 7.5 7.6 Importing Modules.
Initialize variables. You should create two flag variables and initialize them to a value of true: one for when an invalid value is entered and one for when the user chooses to stop the processing (i.e., validValue, processing).
Create a conditional loop that will continue the processing until the user chooses to exit.Hint: Use the processing flag you just created in step 3 as your test condition.Reference: Refer back to Learn to Program With Python 3: A Step-by-Step Guide to Programming, 2nd edition, Chapter 6: Loops / The While Statement.
Accept a distance value and unit of length from the user and store these two values in variables. Use prompts such as:Please enter a distance value:What is the unit of length (M = miles, KM = kilometers):Hint: Preface your input statement with float to ensure the value they enter is stored as a decimal number for use in the conversion formulas.Reference: Refer back to your Unit 1 readings in Learn to Program With Python 3: A Step-by-Step Guide to Programming, 2nd edition, Chapter 3: Built-In Functions / Getting Input From the User.

Reference no: EM133731938

Questions Cloud

What might be the effect of such an opera in today world : What would the events be, and who would the principal characters be? What might be the effect of such an opera in today's world?
What you must do to respond appropriately : Explain the ethical dilemma this situation poses and what you must do to respond appropriately.
What are control purpos and management assertions supported : What are the control purposes and management assertions supported by bank reconciliation? Briefly explain Assurance Services, Attest services and Trust Service.
Discuss european demand for spices to disguise tainted meat : Why does FFA consider the European demand for spices "to disguise tainted meat and fish" as "one of the greatest myths of the history of food"?
Write a program that demonstrates the use of user-defined : Write a program that demonstrates the use of user-defined modules by invoking functions from imported modules. Your program will accept a distance
Which section do you find the most challenging : With each area you have discovered thus far, which section do you find the most challenging?
Explain how the early labor movements : Explain how the early labor movements, such as the formation of unions and collective bargaining efforts, shaped the origins of labor relations.
Degenerative or possibly terminal : In the case of a disease that is degenerative or possibly terminal, such as cancer, a team of doctors and medical personnel work with the patient
Create a program to display a traditional japanese : Create a program to display a traditional Japanese haiku consisting of three phrases on separate lines and comprising a total of 17 syllables

Reviews

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd