My Conversion Library

conversion

Learning Objectives


In this challenge you will learn how to create your own library and how to use it in your programs.

A library is a collection of functions and procedures. A library can then be reused in all your programs using the import instruction.

You have most likely used some libraries in the past, for instance the random library or the maths library.

We are going to create our own library focusing on conversion formulas. It will be useful when we need to convert for example distances from one unit to another (e.g. miles to km, cm to inches).

We have started the library for you by defining two functions: kmToMiles() and milesToKm().

Your Challenge


Complete the library to add the following conversion functions (Roll-over the frames below to reveal the conversion formula):

conversion-distanceConverting Distances

conversion-miles-to-km-1
conversion-inches-to-cm-1
conversion-temperatureConverting Temperatures

conversion-celsius-to-fahrenheit-1
conversion-weightConverting Weights

conversion-kg-to-lb-1
conversion-timeTime Conversion

conversion-seconds-1
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 4.5 / 5. Vote count: 10

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!