照着 README 跑,第几步会卡住

👁️ 2 人浏览 💬 0 人评论 ❤️ 添加收藏

README 给了四步,而仓库里实际只有 main.py、calc.py、README.md。运行下面这段程序,看第几步会失败:

def dry_run(steps, files):
    for i, (cmd, need) in enumerate(steps, 1):
        if need and need not in files:
            return i, need
    return 0, None

steps = [('git clone https://example.com/calc.git', None),
         ('cd calc', None),
         ('pip install -r requirements.txt', 'requirements.txt'),
         ('python main.py', 'main.py')]
files = ['main.py', 'calc.py', 'README.md']
i, need = dry_run(steps, files)
print(str(i) + "/" + str(need))
提交你的答案
请登录后提交答案。
去登录
代码编辑器
Ctrl + Enter 运行
本次输入:
输出:

                        
👩‍🏫
AI
💬 题目评论

全部评论