Python Forum
Python random formatting issues
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python random formatting issues
#8
Thanks guys for the quick replies i'll definitely use this information,
But its also not quite the issue i'm running into. Its that on two occasions when I have programmed something that involves formating a string or a list, it will work on 4 out of the 5 strings but there's one that just ignores it, everything is the same between them but it just doesn't change.

So for example one script I have 6 calculations that each returns a float and I want to round down so I use a round command.
It will work on 5 of them but the last one just returns the same number.

def dms_calc(DMS,DMS_Cost, Cost_Opinion):
    import math
    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)
and the with the script I was talking about at the start it does the same were it will work on 80% of the lists but it just ignores some of them. It just seems like a bug and was wondering if anyone else had experience with something like this.
Reply


Messages In This Thread
Python random formatting issues - by Barnettch3 - Jan-24-2018, 06:05 PM
RE: Python random formatting issues - by Larz60+ - Jan-24-2018, 06:35 PM
RE: Python random formatting issues - by j.crater - Jan-24-2018, 06:54 PM
RE: Python random formatting issues - by j.crater - Jan-24-2018, 07:02 PM
RE: Python random formatting issues - by snippsat - Jan-24-2018, 09:33 PM
RE: Python random formatting issues - by Barnettch3 - Jan-28-2018, 09:03 PM
RE: Python random formatting issues - by Barnettch3 - Jan-28-2018, 10:31 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  String formatting (strptime) issues Henrio 2 937 Jan-06-2023, 06:57 PM
Last Post: deanhystad
  python-docx: preserve formatting when printing lines Tmagpy 4 2,292 Jul-09-2022, 01:15 AM
Last Post: Tmagpy
Shocked Issues Installing Pyenv/Python 3.9.1 Brandon_Contactum 1 2,680 Feb-22-2022, 06:32 PM
Last Post: snippsat
  OpenPyXl formatting issues kpayney1 0 1,782 Nov-26-2021, 01:56 AM
Last Post: kpayney1
  Formatting issues? Mark17 1 1,778 Dec-30-2020, 04:17 PM
Last Post: Mark17
  Changing to new Python formatting example leodavinci1990 3 2,111 Sep-22-2020, 07:36 PM
Last Post: yaythomas
  TurtleWorld on MAC in Python 3.6 issues benniehanas 3 3,795 Jul-09-2018, 08:00 PM
Last Post: ichabod801
  Issues with Python script as service satishgunjal 8 7,693 Jun-21-2018, 11:40 AM
Last Post: satishgunjal
  python variable issues - using spyder and opencv Afrodizzyjack 5 5,930 Jun-19-2018, 09:46 AM
Last Post: gontajones
  issues while using Psexec from python code dev_devil_1983 0 3,638 May-28-2018, 07:55 AM
Last Post: dev_devil_1983

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020