gpt4 book ai didi

python - : `if x.isupper() and not in y` 行语法错误

转载 作者:太空宇宙 更新时间:2023-11-04 09:17:55 24 4
gpt4 key购买 nike

我收到指向“in”语句的“无效语法”错误。我的错误是什么?

while(notes > 1):
note = choice(scale)
if note[0].isupper() and not in patternNotes:
patternNotes.append(note)
notes -= 1

elif note is not rootNote and note not in patternNotes:
patternNotes.append(note)
notes -= 1

最佳答案

你可能想要

if note[0].isupper() and note not in patternNotes:

而不是

if note[0].isupper() and not in patternNotes:

注意第二个中缺少的note

关于python - : `if x.isupper() and not in y` 行语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6626176/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com