Unit Conversion Program Using Python Program Demonstrate Create Use Modules Use Modules Co Q37106334

Unit conversion program (Using Python)

This program will demonstrate how to create and use modules. Wewill use modules to convert from inches to meters and from metersto inches. It will demonstrate how to define functions withinmodules and how to import the module functions in otherprogram.

Week6Exercise.PNG

InputProcessingOutput

menuSelection

dimension

If menuSelection is 1

Convert from meters to inches

Else if menuSelection is 2

   Convert from inches to meters

Else

   exit

Dimension in converted units

DIRECTIONS:

  1. Open IDLE and start a new file
  2. Safe the file under name converter.py
  3. Create to functions in the file for unit coversion:
    def meterToInch(metricValue):

       return metricValue * 100 /2.54

def inchToMeter(inchValue):

    return inchValue *2.54 /100

  1. Start new file
  2. From
    OR
    OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.