[Tutor] newbie question 2

alan.gauld@bt.com alan.gauld@bt.com
Wed, 17 Nov 1999 10:38:01 -0000


> def numwords(s):
>     list = string.split(s)
>     return len(list)
> 
> What does the (s) mean ?  Thanks..

Uh oh,. another one from my tutorial...

If you go back to the top of the Modules page
(called "Making it even it even easier")you'll find 
the following explanation:

------------------------------------
Using Functions

Before considering how to create functions let's look 
at how we use the many, many functions that come with any
programming language (often called the library). 

We've already seen some functions in use and listed others 
in the operators section. Now we'll consider what these
have in common and how we can use them in our programs. 

The basic structure of a function is as follows: 

aValue = someFunction(anArgument, another, etc...)

That is a variable takes on a value obtained by calling a function. 
The function can accept 0 or many arguments which it treats like 
internal variables. Functions can call other functions internally. 
Let's consider some examples in our various languages to see how this works:


--------------------------------

The key is in the last paragraph. It sounds like you feel 
that is insufficient. If so please mail me directly and 
I'll incorporate your feedback into the tutor.

Thanks,

Aan G.