<p>您的代码中有几个错误。您应该学习一些python的基本教程,这些教程应该展示如何调用函数和处理用户输入</p>
<p>您不调用函数,应该将输入转换为<code>int</code>s:</p>
<pre class="lang-py prettyprint-override"><code>def answers():
ppv = tp/(tp + fp)
rcl = tp/(tp + fn)
return ppv, rcl
print("enter the value of true positive")
tp = int(input())
print("enter the value of false negative")
fn = int(input())
print("enter the value of false positive")
fp = int(input())
print("enter the value of true negative")
tn = int(input())
print('ppv and recall answers')
print(answers())
</code></pre>
<p>也许更好的版本是将数字转换为<code>float</code>并将其作为参数传递:</p>
<pre class="lang-py prettyprint-override"><code>def answers(tp, fn, fp):
ppv = tp/(tp + fp)
rcl = tp/(tp + fn)
return ppv, rcl
print("enter the value of true positive")
tp = float(input())
print("enter the value of false negative")
fn = float(input())
print("enter the value of false positive")
fp = float(input())
#print("enter the value of true negative")
#tn = float(input())
print('ppv and recall answers')
print(answers(tp, fn, fp))
</code></pre>
<p>注意,我已经注释掉了请求<code>tn</code>的位,因为它没有在<code>answers()</code>函数中使用</p>