飞翔小鸟的小鸟 2022-12-03 11:07 采纳率: 50%
浏览 42
已结题

python EOFERROR: EOF when reading in a line

I was just coding in Microsoft Visual Studio, and it didn't work, with a EOFERROR.

img

r=0
print('Welcome to Counting! ')
while(1==1):
    while(r>=0):
        if(r==0):
            print('Type "c" to show the Copyright, type "s" to start.')
            s=input() #The EOFERROR is here
            if(s==('c')):
                print('Copyright Fxxndxn. All Rights Reserved. ')
            elif(s==('s')):
                print('Start Now! ')
                r+=1
                x=input('Type your first number here: ') #I think here is also a error
                if x.isdigit():
                    z=input('Type your operator here: ') #Also here
                    y=input('Type your second number here: ') #And here
                    if y.isdigit():
                        p=eval(x+z+y)
                        print('result:',p)
                    else:
                        print('please start again. ')
                        continue
                else:
                    print('please start again. ')
                    continue
        elif(r>0):
            print('Type "c" to show the Copyright, type "s" to start, type "e" to exit. ')
            s=input() #Here
            if(s==('c')):
                print('Copyright Fxxndxn. All Rights Reserved. ')
            elif(s==('e')):
                break
            elif(s==('s')):
                print('Start Now! ')
                r+=1
                x=input('Type your first number here: ') #Here
                if x.isdigit():
                    z=input('Type your operator here: ')#Here
                    y=input('Type your second number here: ')#Here......
                    if y.isdigit():
                        p=eval(x+z+y)
                        print('result:',p)
                    else:
                        print('please start again. ')
                        continue
                else:
                    print('please start again. ')
                    continue
    print('Are you sure to leave? (Y/N) ')
    a=input()
    if(a==('y')):
        break
    elif(a==('n')):
        continue


The Error is: EOFERROR: EOF when reading a line

I don't know how to solve this error, so I have to ask you.

Help me with this error, please!

  • 写回答

1条回答 默认 最新

  • chuifengde 2022-12-03 11:38
    关注
    没有错啊。
    看运行过程:
    Welcome to Counting! 
    Type "c" to show the Copyright, type "s" to start.
    we
    Type "c" to show the Copyright, type "s" to start.
    c
    Copyright Fxxndxn. All Rights Reserved. 
    Type "c" to show the Copyright, type "s" to start.
    s
    Start Now! 
    Type your first number here: 12
    Type your operator here: +
    Type your second number here: 34
    result: 46
    Type "c" to show the Copyright, type "s" to start, type "e" to exit. 
    
    
    
    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 1月22日
  • 修改了问题 12月3日
  • 修改了问题 12月3日
  • 修改了问题 12月3日
  • 展开全部