Write a program to convert a fraction to a decimal. Have your program ask for the numerator first, then denominator. Make sure to check if the denominator is zero.
def check(n,d):
if d==0:
return "denominator is zero"
else:
return n/d
n = int(input())
d = int(input())
print(check(n,d))
Comments
Leave a comment