Simple length converter
Level: Beginner (score: 2)
Your task is to complete the convert() function. It's purpose is to convert centimeters to inches and vice versa. As simple as that sounds, there are some caveats:
convert():
- The function will take
valueandfmtparameters: value: must be anintor afloatotherwise raise aTypeErrorfmt: string containing either"cm"or"in"anything else raises aValueError.- returns a
floatrounded to 4 decimal places.
Assume that if the value is being converted into centimeters that the value is in inches and centimeters if it's being converted to inches.
That's it!