Search code examples
pythonaddition

I have been working here on basic calculator based on a formula in python


def answers():
    ppv = tp/(tp + fp)
    rcl = tp/(tp + fn)
    return ppv, rcl


print("enter the value of true positive")
tp = input()
print("enter the value of false negative")
fn = input()
print("enter the value of false positive")
fp = input()
print("enter the value of true negative")
tn = input()
print('ppv and recall answers')
print(answers)

this is a basic calculator based on the formula in python and it doesn't show any error but also doest show the required output please check the below image for more info

here check the output it returns something like this <function answers at 0x000002377567F040>


Solution

  • See below (something like this):

    • get the input from the user
    • call the function and pass the arguments
    def answers(tp, fp, fn):
         ppv = tp / (tp + fp)
         rcl = tp / (tp + fn)
         return ppv, rcl
        
        
    print("enter the value of true positive")
    _tp = input()
    print("enter the value of false negative")
    _fn = input()
    print("enter the value of false positive")
    _fp = input()
    
    print('ppv and recall answers')
    print(answers(int(_tp), int(_fp), int(_fn)))