LearnPy Hub
← All topics
Topic Practice · Advanced

Context Managers problems

50 problems: 22 Easy, 18 Medium, 10 Hard.

Review the Context Managers lesson
✓1. with open()
4 test cases
EasyNot tracked
✓2. Enter and Exit
4 test cases
EasyNot tracked
✓3. Nested Tags
4 test cases
EasyNot tracked
✓4. @contextmanager
4 test cases
EasyNot tracked
✓5. Suppress an Error
4 test cases
EasyNot tracked
✓6. Start and End Messages
4 test cases
EasyNot tracked
✓7. What as Gives You
4 test cases
EasyNot tracked
✓8. Yield a Value
4 test cases
EasyNot tracked
✓9. Closed Automatically
4 test cases
EasyNot tracked
✓10. Write With with
4 test cases
EasyNot tracked
✓11. Hello and Goodbye
4 test cases
EasyNot tracked
✓12. @contextmanager Hello
4 test cases
EasyNot tracked
✓13. The Value After as
4 test cases
EasyNot tracked
✓14. __exit__ Runs After an Error
4 test cases
EasyNot tracked
✓15. Ignore a Missing Key
4 test cases
EasyNot tracked
✓16. Two Files in One with
4 test cases
EasyNot tracked
✓17. Closed After the Block
4 test cases
EasyNot tracked
✓18. Enter Returns a List
4 test cases
EasyNot tracked
✓19. Underlined Heading
4 test cases
EasyNot tracked
✓20. Count the Blocks
4 test cases
EasyNot tracked
✓21. Append With with
4 test cases
EasyNot tracked
✓22. Which Error Reached __exit__?
4 test cases
EasyNot tracked
✓23. Clean-up After an Error
4 test cases
MediumNot tracked
✓24. Swallow One Error Type
4 test cases
MediumNot tracked
✓25. Capture Printed Output
4 test cases
MediumNot tracked
✓26. Indentation Manager
4 test cases
MediumNot tracked
✓27. Temporary Setting
4 test cases
MediumNot tracked
✓28. Two Files at Once
4 test cases
MediumNot tracked
✓29. Timer Without Time
4 test cases
MediumNot tracked
✓30. closing()
4 test cases
MediumNot tracked
✓31. Safe File Stats
4 test cases
MediumNot tracked
✓32. Count and Ignore Errors
4 test cases
MediumNot tracked
✓33. A Pool of Resources
4 test cases
MediumNot tracked
✓34. Nested Log Prefixes
4 test cases
MediumNot tracked
✓35. Which Errors Were Suppressed?
4 test cases
MediumNot tracked
✓36. Undo a List on Error
4 test cases
MediumNot tracked
✓37. Nested Depth Counter
4 test cases
MediumNot tracked
✓38. Temporary Decimal Precision
4 test cases
MediumNot tracked
✓39. A Writer That Counts Lines
4 test cases
MediumNot tracked
✓40. Record the Error, Keep Going
4 test cases
MediumNot tracked
✓41. All or Nothing
4 test cases
HardNot tracked
✓42. Many Resources
4 test cases
HardNot tracked
✓43. Inspect the Exception
4 test cases
HardNot tracked
✓44. Lock Simulation
2 test cases
HardNot tracked
✓45. Working in a Folder
4 test cases
HardNot tracked
✓46. Optional Context
4 test cases
HardNot tracked
✓47. All or Nothing File Write
4 test cases
HardNot tracked
✓48. Cleanup Even on Errors
4 test cases
HardNot tracked
✓49. Nested Transactions
4 test cases
HardNot tracked
✓50. Profile Sections With a Fake Clock
4 test cases
HardNot tracked
← Back to all topics
Context Managers practice problems · LearnPy Hub