On Tue, 18 Apr 2006, Danny Yoo wrote:
> Just as a side note: no semicolons needed. *wink*
Yesterday, I tested something with a two-line perl program. I could not
for the life of me see why I was getting a syntax error. It was only
after 15 minutes of looking up red herrings that it finally d
> New at this but the f(x) with the return statement passes the value back
> to be used in something. The one with the print statement just prints
> it. Correct me if I am wrong experts
> def f(x):
> x = x + 1;
> return x
>
> def g(x):
> x=x + 1;
> print x;
Hi Eric,
Yes, you've got it
Payal Rathod wrote:
On Mon, Apr 17, 2006 at 05:42:05PM +0100, Steve Nelson wrote:
When you define a function, you are writing a block of code which you
can ask to perform a task. The task may be simple, and not require
any additional information, or it may be more complex and need
informati
On Mon, Apr 17, 2006 at 10:31:04AM -0700, Danny Yoo wrote:
> One view that's common is the idea that a function is a box that takes
> an input and returns an output:
Thanks a lot for the detailed help. Well, I have now got atleast basics
of functions, will be doing some more reading on it in nex
Wow! I checked the list at lunchtime and there were only a few things
here, then I check again now and lots of stuff from my tutor! Fortunately
most of it has been answered already - thanks folks - but I feel honour
bound to contribute something...
> What is the difference between,
>
def
This only happens because the python interactive command-line (what you
get when you just type 'python' in a terminal window) prints return
values automatically for you.
If you were executing
f(4)
in a program/script, the return value would be lost.
Paul
Payal Rathod wrote:
> On Mon, Apr 17,
On Mon, 17 Apr 2006, Payal Rathod wrote:
> What is the difference between,
>
def f(x):
> ... return x
> ...
f(4)
> 4
>
def f(x):
> ... print x
> ...
f(4)
> 4
>
> Both give same results.
Clarification. Both "show" the same results from the interpreter. From
what yo
> Sorry, but you have confused me more ;) Can you give an simple example
> of just function() ? Where can it be useful?
>
> And when you say it returns a value, what do you mean by that? return to
> whom and what exactly?
One view that's common is the idea that a function is a box that takes an
On Mon, Apr 17, 2006 at 05:42:05PM +0100, Steve Nelson wrote:
> When you define a function, you are writing a block of code which you
> can ask to perform a task. The task may be simple, and not require
> any additional information, or it may be more complex and need
> information.
What is the di
On Mon, Apr 17, 2006 at 05:10:51PM +0100, Robert Schumann wrote:
> You could say "I kick" (which is like func(), because you're not
> specifying an object to operate on) or your could say "I kick the
> ball" (in which case x = "the ball").
>
Sorry, but you have confused me more ;)
Can you give
Payal Rathod wrote:
> Hi,
> I am now reading Alan's tut on Python, before that I have read a few other
> tuts too.
> But I am not getting functions exactly. I mean what is the difference between,
>
> def func():
>
>
> and
>
> def func(x):
>
>
> When to use which? (please
On Mon, Apr 17, 2006 at 05:02:07PM +0100, Adam wrote:
> The x is a name for a value that you pass in to the function. To call
> the first function you would do
> >>> func()
>
> and the second function:
> >>> func(5) # 5 is just an example it could be any value depending on
> the function.
Sorry b
Sorry - including list.
On 4/17/06, Payal Rathod <[EMAIL PROTECTED]> wrote:
> what is the difference between,
>
> def func():
>
>
> and
>
> def func(x):
>
When you define a function, you are writing a block of code which you
can ask to perform a task. The task may be si
On 17/04/06, Payal Rathod <[EMAIL PROTECTED]> wrote:
> Hi,
> I am now reading Alan's tut on Python, before that I have read a few other
> tuts too.
> But I am not getting functions exactly. I mean what is the difference between,
>
> def func():
>
>
> and
>
> def func(x):
> ...
Hi,
I am now reading Alan's tut on Python, before that I have read a few other tuts
too.
But I am not getting functions exactly. I mean what is the difference between,
def func():
and
def func(x):
When to use which? (please do not say "returns a value" for I do not un
15 matches
Mail list logo