无法运行python程序

问题描述 投票:0回答:1
def decideReward(points):
    if not(isinstance(points, int)):
        decision = "invalid"
        print("Invalid input! You should provide an integer!")
        return decision
    if points < 0:
        decision = "invalid"
        print("Invalid input! You should provide a non-negative   integer!")
        return decision
    if points < 500:
        decision = "no reward"
    else:
        if points < 1500:
            decision = "appetiser"
        else:
            if points < 5000:
                decision = "main course"
            else:
                if points <= 10000:
                    decision = "fine dining set"
                else:
                    decision = "unable to earn > 10000"
    print("The reward is: " + decision)
    return decision`

这是我的文件loyalty.py的代码,位于'/Users/rakshitdhanda/Downloads/SQT_lab7_pack2/lab7'

我正在尝试在终端中运行此代码 MacBook-Air ~ % cd /Users/rakshitdhanda/Downloads/SQT_lab7_pack2 MacBook-Air SQT_lab7_pack2 % cd lab7 MacBook-Air lab7 % python3loyalty.py MacBook-Air lab7 %决定奖励(4000)

作为我的终端输入,我期待“主菜”的所需输出,但不断得到输出“zsh:未知文件属性:4”,请帮助我,Python和终端新手,已经被困在这个问题上2天了。

python python-3.x debugging terminal attributes
1个回答
0
投票

zsh 正在尝试将您的参数转换为文件扩展名。 尝试通过为参数添加单/双引号将参数转换为字符串。

© www.soinside.com 2019 - 2024. All rights reserved.