Python parentheses mistake (?)

62 views Asked by At

When I run this code

    from numpy import linspace,arange
    from pylab import plot, show
    T=1.05
    pp=[]
    nn=[]
    for V in arange (1,50):
       P=(8*T)/(3*V-1)-3/(V**2)
       a=((V-1/3)*(8/3)*(V**2))/((8/3)*T*(V**3)-6(V-1/3)**2)
       pp.append(P)
       nn.append(a)
    plot(P,a)
    show()

I get:

File "C:\Users\asus\Desktop\", line 8, in <module>
    a=((V-1/3)*(8/3)*(V**2))/((8/3)*T*(V**3)-6(V-1/3)**2)
TypeError: 'int' object is not callable

And I don't know why.

1

There are 1 answers

0
Anand S Kumar On

Issue is in line -

a=((V-1/3)*(8/3)*(V**2))/((8/3)*T*(V**3)-6(V-1/3)**2)

You are using 6(V-1/3) , you need to use - 6*(V-1/3) , as -

a=((V-1/3)*(8/3)*(V**2))/((8/3)*T*(V**3)-6*(V-1/3)**2)