C2W2 Assistance

The difficulty spike on this lab was alarming to say the least. I couldn’t work through Exercise 2 in the lab time limit. I completely understand what I am supposed to do, but I don’t see how to accomplish it using the provided code.

I do not use Python regularly, and I can’t see how the default code with the additions requested will increment the offset value, and indeed the loop doesn’t either. How is the “offset” variable in the while loop interfacing with the kwargs dictionary? I guessed it would when kwargs is re-declared in the loop, but this doesn’t work.

I think if I rewrote things I could get it working, but I suspect this wouldn’t work with the automated grading system. With no solution file I’m at a loss here.

Hello @cli_user , I am not an expert in python as wel but I will try to be as helpful as possible. Regarding the lab time limit is barely enough to do everything, it is possible but better keep notes the first time and should be enough time remaining the second.
About Exercise 2 you use the same logic as in the first week’s second lab(dynamodb dealing with function parameters in loops). The main steps here are:

  1. You use the parameters name of the function and put them into kwargs dictionary.
  2. Then you get the total_elements from the response to create the while loop.
  3. Update the offset in the loop until the total_elements reached(break the loop otherwise)
  4. Update the dictionary inside the loop with the new offset value (same as step 1)
  5. Repeat getting responses (endpoint_request) using the updated dictionary (kwargs)

The offset will increment according to limit value which is fixed to 20, everything that happens in the loop (steps 3-5) uses the kwargs dictionary
Hope it is helpful.