jeudi 26 août 2021

Return total sum (if statement)

I'm trying to add the sum total if newstep< newstep+1. How to print the total sum in one value?

for i in range (1,len(newstep)-1):
            if newstep[i]>newstep[i+1]:
                def rec_rank(key,dic):
                    total += (dic[key]/float(sum(dic.values())))
                    return total
                    count+=1
                    #print("hey total", total)
        
    else:
        def rec_rank(key,dic):
            total = dic[key]/float(sum(dic.values()))
            return total 
            count+=1
            #print("this is total", total)

Aucun commentaire:

Enregistrer un commentaire