Answers for "lambda x: %d % ', '.join(x) for integers"

0

lambda x: %d % ', '.join(x) for integers

>>> nums = [1, 2, 3]
>>> magic = lambda nums: int(''.join(str(i) for i in nums)) # Generator exp.
>>> magic(nums)
123
>>> magic = lambda nums: sum(digit * 10 ** (len(nums) - 1 - i) # Summation
...     for i, digit in enumerate(nums))
>>> magic(nums)
123
Posted by: Guest on August-12-2020

Python Answers by Framework

Browse Popular Code Answers by Language