PyLings:解题并学习 Python
PyLings: Solve Exercises and Learn Python

原始链接: https://github.com/thesayfulla/pylings

一个 Python 3.14、无依赖的面试练习集,包含 35 个热身题和 20 个练习题,难度从简单到 Staff 级别。它会自动打开下一题并在保存时重新运行测试,支持导航、提示、重新运行、列表、检查、重置、解答和退出的键盘快捷键。练习涵盖字符串、集合、迭代器、装饰器、异步、缓存、限流、事件总线、任务图、上下文管理器等。解答在单独的文件夹中;面试题在 markdown 文件中。用户应在编码前定义边界情况,并在测试通过后回答讨论题。测试使用 unittest 运行,可通过 `SOLUTIONS=1` 启用参考解答。

Hacker News 新 | 过去 | 评论 | 提问 | 展示 | 工作 | 提交 登录 PyLings:解决练习题并学习 Python (github.com/thesayfulla) 15 分 由 thesayfulla 2 小时前 | 隐藏 | 过去 | 收藏 | 1 评论 help q4y2u35uk 5 分钟前 看起来很有用。内容是用 AI 生成的吗?不是在指责,我只是好奇未来 AI 能用来提升我们,而不是相反。 回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Python interview practice, rustlings-style: 35 warm-ups + 20 interview exercises, from easy to hard. Python 3.14, no dependencies.

It opens the next exercise and re-runs its tests every time you save.

Keys: n next · h hint · r re-run · l list · c check all · x reset · s solution · q quit

Level Folder What's inside
Warm-up exercises/0_warmups/ 35 short "fix this" tasks: strings, collections, functions, classes, iterators, decorators, asyncio…
Middle exercises/1_middle/ 01–06: iterator utils, LRU cache, retry decorator, bug hunt, KV transactions, log report
Middle+ exercises/2_middle_plus/ 07–10: Money, rate limiter, event bus, task graph
Senior exercises/3_senior/ 11–17: contextmanager, single-flight cache, circuit breaker, external sort, async map, worker pool, bug hunt
Staff exercises/4_staff/ 18–20: generator event loop, mini pydantic, DI container

Solutions are in solutions/ (same layout). Interview questions are in questions/middle.md and questions/senior.md.

  1. Don't open solutions/ until the tests pass.
  2. Name the edge cases before you write code.
  3. When the tests pass, answer the Discussion questions at the end of the exercise. That's what interviewers ask.
python3 -m unittest discover -s tests -p "test_ex05*" -v

Check the reference solutions:

SOLUTIONS=1 python3 -m unittest discover -s tests
联系我们 contact @ memedata.com