Login and get codingYour 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
value
andfmt
parameters:
value
: must be anint
or afloat
otherwise raise aTypeError
fmt
: string containing either"cm"
or"in"
anything else raises aValueError
.- returns a
float
rounded 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!
330 out of 335 users completed this Bite.
Will you be the 331st person to crack this Bite?
Resolution time: ~30 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 2.56 on a 1-10 difficulty scale.
» You can do it! 😌