Skip to content

[dict-and-set] 用 set 去重 题目反馈练习5/7复制答案上去都不通过 #291

Description

@zuo-888

哪一题

问题描述

[dict-and-set] 用 set 去重 题目反馈练习5/7复制答案上去都不通过

Activity

  1. walter201230 commented on May 26, 2026

    @walter201230
    Owner

    @zuo-888 感谢反馈,已复现并修复部署 🙏

    根因

    这两道题(练习 5「用 set 去重」、练习 7「求交集」)提示 3「完整代码:」原本只列主逻辑两行(如 unique = sorted(set(nums))、common = sorted(a & b)),不包含 starterCode 给定的 nums = [...] / a = {...}; b = {...} 变量定义。复制整段贴进编辑器替换原内容 → 变量未定义 → 报 NameError → 判分失败。

    跟你写的代码没关系,照抄「完整代码」也一样过不去。

    修复

    把这两题、以及全量扫描发现的另外 26 道同性质题目的提示「完整代码」改成真正完整可粘贴的代码 —— 含变量定义、import、父类定义等所有前置依赖。涉及 list-and-tuple / dict-and-set / conditions-and-loops / iteration / oop / readable-code / pathlib / logging 等章节。

    顺便修了 conditions-and-loops/07-break-continue 的一个独立 bug:starterCode 的 for 循环体只有两行 # 注释、没有真实代码,用户进题直接点「运行」会撞 IndentationError。

    Commit: walter201230/python-lab@29d616e

    已部署到 learn-py.org

    CF Pages 自动构建中(约 2 分钟),完成后请强刷一下(⌘/Ctrl + Shift + R)再重试。

    再次感谢 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions