Divide a Fraction by Two

Published by bangyen in

Create a function that takes a number as an argument and returns half of it.

Examples

half_of("1/2") ➞ "1/4"

half_of("6/8") ➞ "3/8"

half_of("3/8") ➞ "3/16"

Notes

Always return the simplified fraction.

Watch a quick demo on how Edabit works.