Issues with iterating age of item through dictionary in python 3 -
i relatively coding, , trying create piece of code calculate amount of descendants single cat can have. when cat supposed iterate fifth month; dissapears no reason, changing both dictionaries. code follows:
def speciescalc(pt, tbf, abif, toe, bpy, bil, fsn, ifsnm, sn): sn = {} sn2 = {} if abif < toe: in range(0, int(abif) + 1): sn[str(i)] = 0 else: in range(0, int(toe) + 1): sn[str(i)] = 0 sn[str(tbf - 1)] = fsn ##debug print print(sn) in range(0,int(toe)): o in range(0, len(sn)): if o > 0: sn2[str(o)] = sn[str(o-1)] ##debug prints print(o-1) print(sn) print(sn2) else: sn2['0'] = 0 p in range(pt + tbf, len(sn), bpy): sn2['0'] += sn2[str(p)]*bil print(sn2['0']) sn = {} sn = sn2 in range(0, len(sn)): fsn += int(sn[str(i)]) print(str(sn[str(i)])) return (fsn) print(speciescalc(2, 4, 120, 18, 3, 6, 1, 0, 0))
Comments
Post a Comment