我遇到语法错误,我无法弄清楚如何在此代码的第一行更正它。有人可以告诉我格式化有什么问题吗。非常感谢你。 :)在python中
if years < 0 or years == 0:
print(name' cannot have worked zero or negative years!')
Years = float(input("How many years has ",name," worked for the company?")
答案 0 :(得分:1)
这里的错误在于第二行。在打印内部有一个无效的语法。它可能是:
print(name + ' cannot have worked zero or negative years!')
在第3行中没有一个必需的括号,而不是,你需要把+