Bird
0
0

A retry function for DynamoDB is throwing a syntax error. Which of these is the most likely cause?

medium📝 Debug Q7 of 15
DynamoDB - with AWS SDK
A retry function for DynamoDB is throwing a syntax error. Which of these is the most likely cause?
ACalling time.sleep() without parentheses
BUsing a while loop instead of a for loop
CUsing print statements inside the try block
DUsing 'except ProvisionedThroughputExceededException:' without importing the exception
Step-by-Step Solution
Solution:
  1. Step 1: Identify syntax error causes

    Calling time.sleep() without parentheses (e.g., time.sleep 2**retry_count) causes SyntaxError: invalid syntax.
  2. Step 2: Check other options

    Print statements and while loops are syntactically valid; missing exception import causes runtime NameError.
  3. Final Answer:

    Calling time.sleep() without parentheses -> Option A
  4. Quick Check:

    time.sleep without () = SyntaxError [OK]
Quick Trick: Always use parentheses when calling functions like time.sleep(delay) [OK]
Common Mistakes:
MISTAKES
  • Omitting parentheses on time.sleep
  • Confusing runtime NameError for syntax error
  • Misusing loop types or print statements

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes