I need to take my list from MAP and make them 4 decimal places

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MrMcNick
    New Member
    • Mar 2016
    • 1

    I need to take my list from MAP and make them 4 decimal places

    My List that comes from my MAP function I need to get to 4 decimal places

    Code:
    '''
    a = [5,4,6,8,9,12]
    b = [3,5,3,7,4,10]
    c = [4,7,7,4,10,14]
     
    
    #Gets S List
    hlist = map(add,a,b)
    h2list = map(add,hlist,c)
    twolist = [2,2,2,2,2,2]
    s = map(truediv,h2list,twolist)
    
    
    sqrtlist = [0.5,0.5,0.5,0.5,0.5,0.5]    
    sa = map(sub,s,a) # (s-a)
    sb = map(sub,s,b) # (s-b)
    sc = map(sub,s,c) # (s-c)
    sasb = map(mul,sa,sb) # (s-a)*(s-b)
    sall = map(mul,sasb,sc) # (s-a)*(s-b)*(s-c)
    x = map(mul,s,sall) # Multiplies inside by s
    
    def square(x):
        return x**0.5
        
    A = map(square,x)
    
    
    AA = map(lambda x: x**0.5,x)
    '''
    """
    #OUTPUT
    AA list
    [6.0, 9.797958971132712, 8.94427190999916, 13.997767679169419, 17.984368212422698, 58.787753826796276]
     
    [6.0, 8.0, 8.0, 9.5, 11.5, 18.0]
    """
    Thats my current code, minus some things. The numbers are correct I just need to to be rounded
    Last edited by Rabbit; Mar 15 '16, 05:25 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
Working...