Basic Question

Karthikesh Raju karthik at james.hut.fi
Fri Feb 15 15:47:53 EST 2002


Hi,

Just started, so my question might be stupid. i tried this:

import random

def randomList(n):
    s = [0] * n
    for i in range(n):
        s[i] = random.random()
    return s

in a file called randomList.py. Started python, imported randomList
(>> import randomList) and then called this function (>>
randomList(5)), got this un-understandable error:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: object of type 'module' is not callable

But when i when type the function at the python command prompt, it
works. Couldnt figure out why..

Thankx in advance,

Best wishes
karthik



More information about the Python-list mailing list