Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Here is what I have and it is not working properly: program: from functions import (convertmf, convertfm) def main(): length = (input('Enter the length to

image text in transcribed

Here is what I have and it is not working properly:

program:

from functions import (convertmf, convertfm)

def main(): length = (input('Enter the length to convert: ')) choice = (input('Enter M or F to convert enterted value to Meters or Feet: ')) if choice==F: print('The length', length,'Meters converts to',functions.convertmf(choice),'Feet.',format(length,convertmf,'.2f')) elif choice==M: print('The length', length, 'Feet converts to',functions.convertfm(choice),'Feet.',format(length,convertfm,'.2f')) else: print('Error: invalid selection.')

main()

functions:

#the formula for converting feet to meters is feet = meters/0.3048 #the formula for converting meters to feet is meters= feet * 0.3048

def convertmf(choice): return length*0.3048

def convertfm(choice): return length/0.3048

The total is 649 3. Create a custom Python module named functions.py. This module must contain two functions: one that converts from Feet to Meters and one that converts from Meters to Feet. These functions must be named convertmf (used when Fis selected) and convertfm ( used when M is selected). Write a program named program53.py, which imports the functions from module functions.py. The program's main() should prompt the user to specify M or Fas choices then call the appropriate function which was imported. Conversion accuracy should use full precision ( 5 decimal places ) for the calculations, and display then print the result to two decimal places. Enter the length to convert: 25.75 Enter Mor F to convert enterted value to Meters or Feet: M The length 25.75 Feet converts to 7.85 Meters. Enter the length to convert: 25.75 Enter M or F to convert enterted value to Meters or Feet: F The length 25.75 Meters converts to 84.48 Feet. Tip: Use the import keyword: import functions from * . The call the functions, would be functionname()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students explore these related Databases questions