Kodewick
开始学 →
入门←→0 / 100

点名

#092入门列表循环约 3 分钟

老师点名。names 是全班名单,here 是今天来了的人。写 absent(names, here),按名单的顺序返回没来的人;都来了就返回空列表 []。

示例
absent(["Ann", "Bo", "Cai", "Dee"], ["Bo", "Dee"])→['Ann', 'Cai']
absent(["Ann", "Bo"], ["Bo", "Ann"])→[]
main.py
def absent(names, here):
    missing = []
    for name in names:
        # 在这里写:name 不在 here 里,就放进 missing
        pass
    return missing
Ctrl + Enter 也能运行
结果

写好了先点「运行」试试示例,没问题再点「提交」。