try
---------------------------------------
#!/usr/bin/env python
from types import ListType, IntType
def array_expander( ar=None, ex=None ):
if type( ex ) != IntType:
return []
if ex <= 0:
return []
if type( ar ) != ListType:
return []
# working code starts here #
res = []
for t in ar:
for x in range( ex ):
res.append( t )
return res
# function ends #
res = array_expander( [1,11,3,5], 4 )
print res
---------------------------------------
[1, 1, 1, 1, 11, 11, 11, 11, 3, 3, 3, 3, 5, 5, 5, 5]
--
*Kiri-kin-tha's* First Law of Metaphysics is /"Nothing unreal exists."/
--
http://mail.python.org/mailman/listinfo/python-list