a.py 254 Bytes Edit 1 2 3 4 5 6 7 8 9 10 11 12 list_a=[] def abc(): while True: try: unit=int(input("请输入:")) if unit=='q': break except: break else: list_a.append(unit) return(sum(list_a))