[Tutor] Trajectory Syntax Error
Emile van Sebille
emile at fenx.com
Wed Mar 30 17:05:56 CEST 2011
On 3/30/2011 7:26 AM Carla Jenkins said...
> I am new to Python learnig for a class. When I try using trajectory I receive an error. Here is the code:
> def logistic(x):
> return 4*x*(1-x)
> SyntaxError: invalid syntax
Be sure to copy and paste in exactly the code that results in the error.
As you can see below when I use your example there is no error. This
makes it hard as we now have to guess what you may have done.
I do see one issue -- when you intend to execute your function you need
to enclose the parameters in parens. eg, use logistic(0.11)
ActivePython 188.8.131.52 (ActiveState Software Inc.) based on
Python 2.6.1 (r261:67515, Dec 5 2008, 13:58:38) [MSC v.1500 32 bit
Type "help", "copyright", "credits" or "license" for more information.
>>> def logistic(x):
... return 4*x*(1-x)
>>> def trajectory(a,b):pass
More information about the Tutor