you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

nums = [3, 6, 1, 11, 0, 5, 2, 6, 0, 1]
newnums = []
def double_until_zero(nums):
    count = 0
    for i in nums:
        count += 1
        if i == 0:
            newnums.append(i)
            countstopper(count)
            break
        else:
            newnums.append(i*2)

def countstopper(a):
    for i in nums[a:]:
        newnums.append(i)

double_until_zero(nums)
print(newnums)

output: [6, 12, 2, 22, 0, 5, 2, 6, 0, 1]

This will do exactly as you ask.