Basic Question

Karthikesh Raju karthik at james.hut.fi
Fri Feb 15 21:47:53 CET 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