题解 | #记负均正II#

记负均正II

https://www.nowcoder.com/practice/64f6f222499c4c94b338e588592b6a62

fs=0   #负数统计个数
list1=[]       #非负算平均值

while 1:
    try:
        x=int(input())

        if x<0:
            fs+=1
        else:
            list1.append(x)
        if len(list1)==0: 
            out=0.0
        else : 
            mean=sum(list1)/len(list1)
            out=round(mean,1)
    except:
        break
        
print(fs)
print(out)
#华为od#
全部评论

相关推荐

牛客92804383...:在他心里你已经是他的员工了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务