Answer:
fraction = input("enter fraction x/y: ")
if len(fraction) == 3:
if fraction[1] == "/":
try:
num = int(fraction[0])
den = int(fraction[2])
if num < den:
print(f"{num}/{den} is a proper fraction")
else:
if num% den == 0
print(f"{num}/{den} is an improper fraction and can be reduced to {num/den}")
else:
print(f"{num}/{den} is an improper fraction and can be reduced to {num//den} + {num - (den * (num//den))}/{den}")
except ValueError:
print("numerator and denominator must be integer numbers")
Explanation:
The try and except statement of the python program is used to catch value error of the input fraction of values that are not number digits. The program converts the numerator and denominator string values to integers and checks for the larger value of both.
The program prints the fraction as a proper fraction if the numerator is lesser and improper if not.