```python try: num_count = int(input()) values = [] count = 0 while True: value = input() if value == "": break try: values.append(int(value)) count += 1 except ValueError: raise ValueError("error: input contents invalid.") if count!= num_count: raise RuntimeError("error: data quatity invalid.") print("the sum is", sum(values)) except RuntimeError as e: print(e) except ValueError as e: print(e) ``` [2024-11-18 22:28:06 | AI写代码神器 | 138点数解答]