Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
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.
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)
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I can't think of what I might be doing wrong: This is the code I've been using, followed by the error I'm getting (thanks in advance for your time):
import scipy.integrate
import numpy as np
integrand= lambda x:((x**1)*(np.exp((-1*(x - 5)**2) / (2 * 10**2)))
intmom = scipy.integrate.quad(integrand, 1, 10)
print(intmom)
Error:
File "", line 3
intmom = scipy.integrate.quad(integrand, 1, 10)
^
SyntaxError: invalid syntax
You are missing a closing ) on the previous line it should be
integrand= lambda x:((x**1)*(np.exp((-1*(x - 5)**2) / (2 * 10**2))))
Output:
(47.53743192883985, 5.277715145894907e-13)
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
def calculate_money_made(**trips):
total_money_made = 0
for trip_id, trip from trips.items():
trip_revenue = trip.cost - trip.driver.cost
total_money_made += trip_revenue
return total_money_made
gives an error! cannot figure out
File "script.py", line 41
for trip_id, trip from trips.items():
^
SyntaxError: invalid syntax
Change "from" to "in"
for trip_id, trip in trip.items():
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I have the following code :
Integration_Minute = 00
Integration_Schedule = '''{"cluster":{"scheduling":{"shutdownHours":{"isEnabled":true,"timeWindows":["Sat:00:00-Mon:04:xx","Tue:00:00-Tue:04:xx","Wed:00:00-Wed:04:xx","Thu:00:00-Thu:04:xx","Fri:00:00-Fri:04:xx"]}}}}'''
print(Integration_Schedule.replace("xx", Integration_Minute))
I want to replace xx with 00 but this doesnt work. Whats the best way of doing this in python ?
The error I get is :
File "s.py", line 4, in <module>
print(Integration_Schedule.replace("xx", Integration_Minute))
TypeError: expected a character buffer object
Integration_Minute = '00'
>>> print(Integration_Schedule.replace("xx", Integration_Minute))
{"cluster":{"scheduling":{"shutdownHours":{"isEnabled":true,"timeWindows":["Sat:
00:00-Mon:04:00","Tue:00:00-Tue:04:00","Wed:00:00-Wed:04:00","Thu:00:00-Thu:04:0
0","Fri:00:00-Fri:04:00"]}}}}
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
Just doing some basic code and then this error popped up. I have no idea what I should fix everything seems fine. (Using Python)
Code:
dict = {'name':'Bob','ref':'Python','sys':'Win'}
print('\nReference:',dict['ref'])
print('n\Keys:',dict.keys()
del dict[ 'name' ]
dict['user']='Tom'
print('\nDictionary:',dict)
print('\nIs There A name Key?:','name' in dict)
C:\Python>dictionary.py
File "C:\Python\dictionary.py", line 4
del dict[ 'name' ]
^
SyntaxError: invalid syntaxer code here
You are missing a parenthesis on line 3. It should be:
print('n\Keys:',dict.keys())
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
Acceleration in a given point is given by a=5-0.004364*v^2
I want to store all the values of v and x and a in lists so that I later can plot them as a function of time. Keep in mind I'm a beginner. This is my code so far:
x_val=0
x=[]
x.append(x_val)
v_val=0
v=[]
v.append(v_val)
a_val=5.0
a=[]
a.append(a_val)
h=0.1
while x_val <=100:
v_val += (a_val*h)
x_val += (v_val*h)
a_val=(5-0.004364*(v_val**2)
a.append(a_val)
v.append(v_val)
x.append(x_val)
I'm getting a syntax error on "a.append(a_val)": invalid syntax
What am I doing wrong here? Please help
There is closed parenthesis missing in the below line
`a_val=(5-0.004364*(v_val**2)`