字母“n”在Python中是无效语法?

2024-04-26 22:22:57 发布

您现在位置:Python中文网/ 问答频道 /正文

它以前在我的程序中是一个变量名,现在突然Python在我的程序中返回字母'n'作为无效语法。在

你知道为什么吗?怎么解决这个问题吗?在

bad_input=True
while bad_input:
    bad_input=False
    User_Choice=int(input('Which frame would you like to choose(1,2,3 represent positive selections, 4,5,6 represent -1,-2, and -3 respectively')
    n = 3
    if User_Choice== int(1):
        Chunks=[RNA_Comp[i:i+n] for i in range(0, len(RNA_Comp), n)]
    if User_Choice== int(2):
        Chunks=[RNA_Comp[i:i+n] for i in range(1, len(RNA_Comp), n)]
    if User_Choice== int(3):
        Chunks=[RNA_Comp[i:i+n] for i in range(2, len(RNA_Comp), n)]
    else:
        print('Please select an integer value from 1 to 6')
        bad_input=True

Tags: in程序trueforinputlenifrange