Creating variables on the fly...

Cliff Crawford cjc26 at nospam.cornell.edu
Mon Apr 3 20:14:19 EDT 2000


This is the simplest solution, but also the most adaptable.  Because
someday, you're going to want to get the list of numbers from a file, or
from a web page, or some other source external to your program; and if
you use *args, then you're going to have to do apply(add, numlist)
instead of just add(numlist).

hi-Matt-I-go-to-Cornell-too!-<g>-ly yrs, Cliff

* Lee, Jaeho <Jhlee at Brooks.com> menulis:
| I think that this is the place you should use list.
| 
| What about this.
| 
| def add(listVar)
|    r = 0
|    for something in listVar
|       r = r + something
|    return r
| 
| I'm still learning python. So please forgive any syntax or naming convetion
| problem.
| 
| Jaeho


-- 
cliff crawford    -><-    http://www.people.cornell.edu/pages/cjc26/
                                                       icq 68165166
"IS I yes wardrobe yield [the] evaluation."     member of A.H.M.A.D.



More information about the Python-list mailing list