math.choice attribute error

iddwb iddwb at imap1.asu.edu
Mon Mar 26 20:27:03 EST 2001


from the ref man math.choice says it takes a sequence object and returns a
random choice. perfect for my needs. the follow happens:

>>> import math
>>> list = ['apple', 'orange', 'pear']
>>> print math.choice(list)
Traceback ....
attributerror: choice

what have I missed?

David Bear
College of Public Programs/ASU




More information about the Python-list mailing list