JJoeven

Quizzes

Python quiz

37 questions from the Python track. Score 80% or higher to unlock a certificate.

  1. Why Python for Agents

    1. How does output appear in the Python boxes on this site?

  2. Variables and Names

    2. Which name follows usual Python style for a variable?

  3. Types: Numbers, Text, True/False, and None

    3. What is bool("False") in Python?

  4. Compare and Combine Values

    4. You have a = [1, 2] and b = [1, 2]. What is true?

  5. Strings (Text)

    5. What does "abcdef"[1:4] return?

  6. Numbers and Math

    6. What is the value of 7 // 2 in Python 3?

  7. True, False, and None

    7. Why can if result lie when result is 0?

  8. Lists

    8. What does memory.append("act") give you back?

  9. Index and Slice

    9. What does "abcd"[1:3] give you?

  10. Tuples and Sets

    10. How do you write an empty set?

  11. Dictionaries

    11. What does action.get("thought", "") give you if thought is missing?

  12. Nested Data (Traces)

    12. How do you read a nested field without crashing if a key is missing?

  13. If, Elif, and Else

    13. What does handle_query("") return if empty text is treated as false?

  14. Match and Case

    14. What does case _ mean in a match?

  15. Loops and Budgets

    15. Which loop fits "run until the goal is true or steps hit 8"?

  16. Functions

    16. What does return do that print does not?

  17. Scope, Defaults, and Extra Arguments

    17. Why is def add_event(event, history=[]) dangerous?

  18. Unpacking

    18. After first, *rest = ["think", "act", "observe"], what is rest?

  19. Modules

    19. When is a module’s __name__ equal to "__main__"?

  20. JSON and Text

    20. Which call turns a Python dict into a JSON string?

  21. with, Files, and Paths

    21. Why use with when you open a file?

  22. Errors and try/except

    22. What is wrong with writing except: with no error type?

  23. Copy vs Change in Place

    23. Two agents share one transcript list. Agent A appends a message. What happens?

  24. Comprehensions

    24. When is a for-loop clearer than a comprehension?

  25. Classes

    25. When is a function enough, with no class?

  26. Dataclasses

    26. What does frozen=True do on a dataclass?

  27. Type Hints

    27. Do type hints stop a wrong JSON value when the program runs?

  28. Useful Standard Library

    28. Why is a long time.sleep a problem in an agent loop?

  29. Regular Expressions

    29. You have a full, clean JSON string from the model. What should you try first?

  30. Logging and Secrets

    30. How should an API key appear in a log?

  31. Virtual Envs and pip

    31. What is a virtual env?

  32. HTTP and APIs

    32. What does status 429 mean?

  33. Parse JSON from a Model

    33. Why should you never eval() text from a model?

  34. Retries and Timeouts

    34. Which result should you retry?

  35. Async in Simple Words

    35. In this lesson, concurrent means…

  36. Tests

    36. Why write tests for tools, parse_action, and goal_satisfied?

  37. A Mini Agent in Python

    37. What should the loop do when it hits max_steps?