Jan-28-2018, 10:31 PM
(Jan-28-2018, 09:23 PM)Gribouillis Wrote:(Jan-28-2018, 09:03 PM)Barnettch3 Wrote: It just seems like a bug and was wondering if anyone else had experience with something like this.If there is a bug, it is in your code, it is not in the python interpreter. The round function does exactly what the documentation says. If you are experimenting errors with formatting, then you need the format method. For example the lineprint(F*100, "%")is better writtenprint('{:.2f} %'.format(F*100))Can you describe the issue more precisely or give a code that we can run to see the pathological behavior?
Thank you that works but im just trying to understand why it would give me this problem in the first place, if you look at item B you can see what I mean.
def dms_calc(): import math DMS = input("Choose DMS Letter A-F").strip().upper() DMS_Cost = 250000 if DMS == "A": A = (0.187547-(0.01836*(math.log10(DMS_Cost/7.76)))) A = round(A,4) print(A*100, "%") print("$",DMS_Cost*A) elif DMS == "B": B = (0.164145-(0.015303*(math.log10(DMS_Cost/7.76)))) B = round(B,4) print(B*100, "%") print("$",DMS_Cost*B) elif DMS == "C": C = (0.142432-(0.010594*(math.log10(DMS_Cost/7.76)))) C = round(C,4) print(C*100, "%") print("$",DMS_Cost*C) elif DMS == "D": D = (0.141419-(0.01236*(math.log10(DMS_Cost/7.76)))) D = round(D,4) print(D*100, "%") print("$",DMS_Cost*D) elif DMS == "E": E = (0.118011-(0.009279*(math.log10(DMS_Cost/7.76)))) E = round(E,4) print(E*100, "%") print("$",DMS_Cost*E) elif DMS == "F": F = (0.09521-(0.006301*(math.log10(DMS_Cost/7.76)))) F = round(F,4) print(F*100, "%") print("$",DMS_Cost*F)
>>> dms_calc() Choose DMS Letter A-FA 10.48 % $ 26200.0 >>> dms_calc() Choose DMS Letter A-FB 9.520000000000001 % $ 23800.0 >>> dms_calc() Choose DMS Letter A-FC 9.47 % $ 23675.0 >>> dms_calc() Choose DMS Letter A-FD 8.57 % $ 21425.0 >>> dms_calc() Choose DMS Letter A-FE 7.62 % $ 19050.0 >>> dms_calc() Choose DMS Letter A-FF 6.68 % $ 16700.0 >>>