Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
有人能帮我解决python上的语法错误吗_Python_Python 3.x - Fatal编程技术网

有人能帮我解决python上的语法错误吗

有人能帮我解决python上的语法错误吗,python,python-3.x,Python,Python 3.x,请帮助我使用此代码,因为我尝试了许多不同的方法,但无法使其工作。谢谢你的帮助 print(" Greenfly Population Model") chocies=[] def option0(): time.sleep(1) print("GOOD BYE") time.sleep(1) # exiting the loop def option1(): if choies==[]: print("Set the Generati

请帮助我使用此代码,因为我尝试了许多不同的方法,但无法使其工作。谢谢你的帮助

print(" Greenfly Population Model")
chocies=[]


def option0():
    time.sleep(1)
    print("GOOD BYE")
    time.sleep(1)
    # exiting the loop

def option1():
    if choies==[]:
        print("Set the Generation 0 values!")
    else:
        print(chocies[:])
def option2():
    print("Display the Generation 0 values")


def option3():
    print("Run the model")

def option4():
    print("Export data")

def option5():
    print("Quit")





import time#for option 0
while True:#to keep the program continuous
    option=int(input("""
    High Scores


0- Exit
1- Show score
2- Add a score
3- Delete a score
4 - Sort the score in ascending order
5- Sort the score in descending order
""")#all different options


s = int(input("from the menu above please pick your choice"))
print("setting the generation 0 values"))
i = int(input("Enter the number of generations you want the model to run for (must be between 5 and 25 inclusive")):
m = int(input("Choose adult survival rate between 0 and 1:"))
o = int(input("Choose Juvenile survival rate between 0 and 1:"))
n = int(input("Choose Senile survival rate between 0 and 1:"))
r = int(input("please enter the initial numbers of juvenile:"))
a = int(input("please enter the initial numbers of adults:"))
i = int(input("please enter the initial numbers of seniles:"))
v = int(input("please enter the initial numbers of the adults:"))

print(s)
print(i)
print(m)
print(o)
print(n)
print(r)
print(a)
print(i)
print(v)



print(" Greenfly Population Model")
option=int(input("""
High Scores


0- Exit
1- Show score
2- Add a score
3- Delete a score
4 - Sort the score in ascending order
5 - Sort the score in descending order
""")#all different options
我的语法错误是

s = int(input("from the menu above please pick your choice"))

s是我的语法错误的地方

您从一开始就有几个问题:

最后失踪了。。。所有不同选项->所有不同选项 :该值不应在i=intinpunter。您希望模型运行的代数必须介于5到25之间(包括5到25代): 设置第0代值时不应出现此问题 与第48行中的1相同 在出现此类错误后检查匹配括号等非常有用:

固定版本:

print(" Greenfly Population Model")
chocies=[]


def option0():
    time.sleep(1)
    print("GOOD BYE")
    time.sleep(1)
    # exiting the loop

def option1():
    if choies==[]:
        print("Set the Generation 0 values!")
    else:
        print(chocies[:])
def option2():
    print("Display the Generation 0 values")


def option3():
    print("Run the model")

def option4():
    print("Export data")

def option5():
    print("Quit")





import time#for option 0
while True:#to keep the program continuous
    option=int(input("""
    High Scores


0- Exit
1- Show score
2- Add a score
3- Delete a score
4 - Sort the score in ascending order
5- Sort the score in descending order
"""))#all different options


s = int(input("from the menu above please pick your choice"))
print("setting the generation 0 values")
i = int(input("Enter the number of generations you want the model to run for (must be between 5 and 25 inclusive"))
m = int(input("Choose adult survival rate between 0 and 1:"))
o = int(input("Choose Juvenile survival rate between 0 and 1:"))
n = int(input("Choose Senile survival rate between 0 and 1:"))
r = int(input("please enter the initial numbers of juvenile:"))
a = int(input("please enter the initial numbers of adults:"))
i = int(input("please enter the initial numbers of seniles:"))
v = int(input("please enter the initial numbers of the adults:"))

print(s)
print(i)
print(m)
print(o)
print(n)
print(r)
print(a)
print(i)
print(v)



print(" Greenfly Population Model")
option=int(input("""
High Scores


0- Exit
1- Show score
2- Add a score
3- Delete a score
4 - Sort the score in ascending order
5 - Sort the score in descending order
"""))#all different options

这就是我到目前为止所做的

print(" Greenfly Population Model")

chocies=[]


def option0():
    time.sleep(1)
    print("GOOD BYE")
    time.sleep(1)
    # exiting the loop

def option1():
    if chocies==[]:
        print("Set the Generation 0 values!")
    else:
        print(chocies[:])
def option2():
    print("Display the Generation 0 values")


def option3():
    print("Run the model")

def option4():
    print("Export data")

def option5():
    print("Quit")





import time#for option 0
while True:#to keep the program continuous
    option=int(input("""

("""
print(" Greenfly Population Model")
chocies=[]


def option0():
    time.sleep(1)
    print("GOOD BYE")
    time.sleep(1)
    # exiting the loop

def option1():
    if choies==[]:
        print("Set the Generation 0 values!")
    else:
        print(chocies[:])
def option2():
    print("Display the Generation 0 values")


def option3():
    print("Run the model")

def option4():
    print("Export data")

def option5():
    print("Quit")


    High Scores

("""
0- Exit
1- Show score
2- Add a score
3- Delete a score
4 - Sort the score in ascending order
5- Sort the score in descending order
""")#all different options


s = int(input("from the menu above please pick your choice"))
print("setting the generation 0 values"))
i = int(input("Enter the number of generations you want the model to run for (must be between 5 and 25 inclusive")):
m = int(input("Choose adult survival rate between 0 and 1:"))
o = int(input("Choose Juvenile survival rate between 0 and 1:"))
n = int(input("Choose Senile survival rate between 0 and 1:"))
r = int(input("please enter the initial numbers of juvenile:"))
a = int(input("please enter the initial numbers of adults:"))
i = int(input("please enter the initial numbers of seniles:"))
v = int(input("please enter the initial numbers of the adults:"))

print(s)
print(i)
print(m)
print(o)
print(n)
print(r)
print(a)
print(i)
print(v)


("""
print(" Greenfly Population Model")
option=int(input
High Scores


0- Exit
1- Show score
2- Add a score
3- Delete a score
4 - Sort the score in ascending order
5 - Sort the score in descending order
#all different options


""")


import time#for option 0
while True:#to keep the program continuous
    option=int(input("""
    High Scores


0- Exit
1- Show score
2- Add a score
3- Delete a score
4 - Sort the score in ascending order
5- Sort the score in descending order
"""))#all different options


s = int(input("from the menu above please pick your choice"))
print("setting the generation 0 values")
i = int(input("Enter the number of generations you want the model to run for (must be between 5 and 25 inclusive"))
m = int(input("Choose adult survival rate between 0 and 1:"))
o = int(input("Choose Juvenile survival rate between 0 and 1:"))
n = int(input("Choose Senile survival rate between 0 and 1:"))
r = int(input("please enter the initial numbers of juvenile:"))
a = int(input("please enter the initial numbers of adults:"))
i = int(input("please enter the initial numbers of seniles:"))
v = int(input("please enter the initial numbers of the adults:"))

print(s)
print(i)
print(m)
print(o)
print(n)
print(r)
print(a)
print(i)
print(v)



print(" Greenfly Population Model")
option=int(input("""
High Scores


0- Exit
1- Show score
2- Add a score
3- Delete a score
4 - Sort the score in ascending order
5 - Sort the score in descending order
"""))#all different options

在你的问题和代码中不起作用的部分要更加具体。前一行缺少一个右括号。你使用的是什么Python版本?还有一个不相关的问题——你两次输入错误,但方式不同。在编程时,你必须注意细节,否则你的程序将无法运行。