Basic Question

Karthikesh Raju karthik at
Fri Feb 15 21:47:53 CET 2002


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 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

More information about the Python-list mailing list