题解 | 记负均正II
def int_negative(): lst = [] while True: try: lst.append(int(input())) except: break negative = 0 sum = 0 positive = 0 for i in lst: if i < 0: negative +=1 else: sum += int(i) positive +=1 if sum > 0: pos_avg = round(float(sum/positive),1) else: pos_avg = 0.0 return negative,pos_avg for i in int_negative(): print(i)