[Tutor] Need to convert 1,987,087,234,456 to an int

Dick Moores rdm at rcblue.com
Thu Aug 16 07:13:10 CEST 2007


To Eric Walker, John Fouhy, and  Eric Brunson:

Thanks very much. I think I'm beginning to get it. At least I was 
able to write a couple of functions that do what I wanted:

=========================
def f(n,m,*args):
     x = n*m
     for arg in args:
         product = arg*x
         x = product
     print product

numbers = 10, 6, 7

f(3,4,*numbers)

# ------------------------------------------

def g(*args):
     n = 0
     for arg in args:
         sum = n + arg
         n = sum
     print sum

numbers = 10, 6, 7, 5, 100

g(*numbers)
============================

They give me 5040 and 128, respectively.

Dick



More information about the Tutor mailing list