执行我的代码时python中的EOFerror

当我运行程序时出现EOFError ...请帮助


import sys

t=raw_input()


while(t>0):

    pa=raw_input()

    if(pa>0.500000):

        ans=10000*pa*(3-(2*pa))

        print '%0.6f' % ans

    if(pa<=0.500000):

        pa=1-pa;

        ans=10000*pa*(3-(2*pa))

        print '%0.6f' % ans    

    t=t-1


月关宝盒
浏览 287回答 1
1回答

炎炎设计

您确实没有在此处提供足够的输入,但是您可以随时尝试以下操作:import syst=raw_input()try:&nbsp; &nbsp; t=int(t)except:&nbsp; &nbsp; sys.exit(1)while(t>0):&nbsp; &nbsp; pa=raw_input()&nbsp; &nbsp; try:&nbsp; &nbsp; &nbsp; &nbsp; pa=float(pa)&nbsp; &nbsp; except:&nbsp; &nbsp; &nbsp; &nbsp; break&nbsp; &nbsp; if(pa>0.500000):&nbsp; &nbsp; &nbsp; &nbsp; ans=10000*pa*(3-(2*pa))&nbsp; &nbsp; &nbsp; &nbsp; print '%0.6f' % ans&nbsp; &nbsp; if(pa<=0.500000):&nbsp; &nbsp; &nbsp; &nbsp; pa=1-pa;&nbsp; &nbsp; &nbsp; &nbsp; ans=10000*pa*(3-(2*pa))&nbsp; &nbsp; &nbsp; &nbsp; print '%0.6f' % ans&nbsp; &nbsp; t=t-1
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python