大佬帮我看看,python!!全错

P1957 口算练习题

zlssg2008 @ 2023-01-31 12:03:48

i=int(input())
yaoshurudesuanshi=input()
def jisuan(fuhao,shu1,shu2):
    if fuhao=='a':
        daan1=int(shu1)+int(shu2)
        print(shu1,'+',shu2,'=',daan1)
        return daan1
    elif fuhao=='b':
        daan2=int(shu1)-int(shu2)
        print(shu1,'-',shu2,'=',daan2,end='')
        return daan2
    elif fuhao=='c':
        daan3=int(shu1)*int(shu2)
        print(shu1,'*',shu2,'=',daan3,end='')
        return daan3
for i in range(1,i+1):
    if 'a'<=yaoshurudesuanshi[0]<='c':
        zl=yaoshurudesuanshi[0]
        yaoshurudesuanshi=yaoshurudesuanshi[2:]
    sanbe=yaoshurudesuanshi.index(' ')
    a=yaoshurudesuanshi[:sanbe]
    b=yaoshurudesuanshi[sanbe+1:]
    jisuan(zl,a,b)

|