Yes, but your way only works when the numbers in the list are single digit:

>>> def listtoint(digits):
    result = 0
    for digit in digits:
        result *= 10
        result += digit
    return result

>>> listtoint([1,2,3,4])
1234
>>> listtoint([11,22,33,44])
13574

-- 
Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to