fonction in python
John Machin
sjmachin at lexicon.net
Tue Jul 4 19:52:31 EDT 2006
On 4/07/2006 8:06 PM, aliassaf wrote:
> Hello,
>
> If we write = x^2 and if I give to the program the values of x, it will
> going to calculate the values of y, and also for x.
>
> But it is possible ? that is if I give to the program the values of X and Y,
> it will indicate to me the relation between the two variables, in the other
> hand if I look to the program x=2 y=4, x=3 y=9 ect... it is going to show me
> that f (t)!!!
Please pardon me for introducing Python-related subject matter into a
thread devoted to curve-fitting :-)
Consider the following:
|>> [x ^ 2 for x in range(10)]
[2, 3, 0, 1, 6, 7, 4, 5, 10, 11]
Not what you wanted? Try this:
|>> [x ** 2 for x in range(10)]
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
Cheers,
John
More information about the Python-list
mailing list