【发布时间】:2019-08-21 19:20:37
【问题描述】:
我正在为我的书制作“书架”的代码,并且我正在制作这样的条件:“当 x 变量小于 y 变量时,继续,否则,中断”,但 python 说这条线,有语法错误,但是,我不明白错误在哪里。
我尝试重新运行代码,验证标识空间等,但对我来说,没有错,而对于 python,有语法错误。
def lista()
cadastrados = 0
livros = int(input("Quantos livros você deseja cadastrar?")
while cadastrados < livros:
print()
linha()
print()
print()
título = input("Put the title of your book: ")
autor = input("Put the writer of your book: ")
gênero = input("Put the gender of your book: ")
cadastrados += 1
if cadastrados >= livros:
break
我期待问题的循环,并将数字添加到“地籍”变量中,如果数字达到限制,“while”循环将停止,但实际结果是“无效语法" 突出显示 "while" 语句
【问题讨论】:
-
第 2 行缺少括号 ;)
标签: python python-3.x loops syntax-error conditional