How to fix this error please check code below i'm just bignner, im trying to make 2 choices one with normal numbers and the other choice is fraction numbers:-
if choice == 1:
a = float(input("Enter First Number: "))
try:
val = float(a)
except ValueError:
print("Please enter only numbers!!")
continue
b = float(input("Enter Second Number: "))
try:
val = str(b)
except ValueError:
print("Please enter only numbers!!")
continue
slo= add(a,b)
print("=", int(slo))
if choice == 2:
a = float(input("Enter First Number: "))
try:
val = float(a)
except ValueError:
print("Please enter only numbers!!")
continue
b = float(input("Enter Second Number: "))
try:
val = str(b)
except ValueError:
print("Please enter only numbers!!")
continue
def fraction(a, b):
fr = Fraction(a, b)
return '{}/{}'.format(fr.numerator, fr.denominator)