Correct a mistake

Report a typo

The code below solves the following problem — having the numerator and the denominator of a fraction, check if the fraction equals 0.5. The program should print True or False. If the denominator equals 0, the answer is False.

def compare(numerator, denominator):
    return denominator and numerator / denominator == 0.5


a = int(input())
b = int(input())

print(compare(a, b))

But this code works incorrectly. Find and correct the mistake, then run the code.

Sample Input 1:

5
10

Sample Output 1:

True

Sample Input 2:

3
0

Sample Output 2:

False

Sample Input 3:

-1
-2

Sample Output 3:

True
Write a program in Python 3
def compare(numerator, denominator):
return denominator and numerator / denominator == 0.5


a = int(input())
b = int(input())

print(compare(a, b))
___

Create a free account to access the full topic