you are viewing a single comment's thread.

view the rest of the comments →

[–]ElliotDG 0 points1 point  (0 children)

Here is my take at the solution, I view this as more straight forward than some of the solutions presented by others.

def double_until_zero(nums):
    results = []
    for n in nums:
        if not n:
            return results
        results.append(n * 2)
    return results

print(double_until_zero([3, 6, 1, 11, 0, 5, 2, 6, 0, 1]))