while True: try: p=list(map(int,input())) ans=0 for i in range(len(p)): if i%2==0: ans+=p[i] else: ans-=p[i] print(ans) except EOFError: break
while True: try: p=list(map(int,input())) ans=0 for i in range(len(p)): if i%2==0: ans+=p[i] else: ans-=p[i] print(ans) except EOFError: break
題目看清楚
輸出說明:其中有一組測資為完全空白,請針對這筆測資輸出'I finish the homework.'("不含引號")
while True: try: p=list(map(int,input())) ans=0 for i in range(len(p)): if i%2==0: ans+=p[i] else: ans-=p[i] print(ans) except EOFError: break
題目看清楚輸出說明:其中有一組測資為完全空白,請針對這筆測資輸出'I finish the homework.'("不含引號")
AC了,感恩