Jose,

the answer to your problem is very simple.

run this:

<code>
#! /bin/python


def frange(xo, xn, incrmt):
   b = []
   sum = xo
      while(sum < xn):
       sum = sum + incrmt
       b.append(sum)
                 return b


a = frange(0, 13.45, 1.5)
print a
</code>

Reason this wasn't working is that in python, you have to define your 
functions *before* you call them.

Cheers,
-Paul

Jose Guevarra wrote:

>Hi,
>
> I was just trying to make a simple range function that works w/ decimal
>numbers instead of just integers. Im new to python and I don't know if
>one already exists, but that's besides the point.  
>
>Im following the examples and syntax that Ive seen but it keeps coming
>up w/ a "name error". It runs fine w/ not defined as a function
>
>Here's the script
>------------------------------
>
>#! /bin/python
>
>a = frange(0, 13.45, 1.5)
>print a
>
>
>def frange(xo, xn, incrmt):
>    b = []
>    sum = xo
>    
>    while(sum < xn):
>        sum = sum + incrmt
>        b.append(sum)
>        
>        
>    return b
>    
>---------------------------------
>
>what's the problem here?
>thanx
>
>_______________________________________________
>ActivePython mailing list
>[EMAIL PROTECTED]
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>



_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to