Answer:
20
Explanation:
During the first iteration for the list [1, 4], numB = 1.
During the first iteration of the list [2, 3], numA = 2.
answer = answer + numA + numB
= 0 + 2 + 1
= 3
Since the list [2, 3] is in a nested loop, we need to first finish iterating the whole list before numB iterates to the next number, so numA = 3 this time and numB still stays at 1.
answer = answer + numA + numB
= 3 + 3 + 1
= 7
Now, numB moves to 4 and numA starts back at 2 again.
answer = answer + numA + numB
= 7 + 2 + 4
= 13
numB still says at 4 and numA moves to 3 since it is in a nested loop:
answer = answer + numA + numB
= 13 + 3 + 4
= 20
print(answer) will print the output 20.
Hope this helps :)
C. The light bulb
Light is not a part of the flashlight and everything is working together to output light from the bulb
Answer:
One approach would be to move all items from stack1 to stack2 (effectively reversing the items), then pop the top item from stack2 and then put them back.
Assume you use stack1 for enqueueing. So enqueue(x) = stack1.push(x).
Dequeueing would be:
- For all items in stack1: pop them from stack1 and push them in stack 2.
- Pop one item from stack2, which will be your dequeue result
- For all items in stack2: pop them from stack2 and push them in stack 1.
Hope it makes sense. I'm sure you can draw a diagram.
Answer:
By clicking the sheet tabs at the bottom of the Excel window, you can quickly select one or more sheets. To enter or edit data on several worksheets at the same time, you can group worksheets by selecting multiple sheets. You can also format or print a selection of sheets at the same time.
Explanation:
hope this helps