Divide a Fraction by Two

Published by wangyang2048 in

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

Examples

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

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

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

Notes

Always return the simplified fraction.

Watch a quick demo on how Edabit works.