def opp(): total = [] while True: unit= input("请输入:") if unit== 'q': break else: try: unit=int(unit) except: print("gui") else: total.append(unit) return total def u(k): w=0 for i in k: w=w+i return w o=u(opp()) print(o)