2017-07-20 3 views
-1

Bitte helfen Sie mir mit diesem Code, wie ich viele verschiedene Dinge ausprobiert habe und es nicht zur Arbeit bekommen. danke für all deine Hilfe.kann mir jemand mit einem Syntaxfehler auf Python helfen

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 

meine Syntaxfehler ist

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

die s ist, wo meine Syntaxfehler

+0

Seien Sie spezifischer in Ihrer Frage und der Teil des Codes, der nicht funktioniert. –

+4

In der vorherigen Zeile fehlt eine schließende Klammer. –

+1

Welche Python-Version verwenden Sie? –

Antwort

2

Sie haben mehrere Probleme (Ende beginnen):

  1. fehlt ) am Ende ... """)#all different options ->"""))#all different options
  2. : die

Checking passende Halterungen und solche nach dieser Art von Fehler als 1 in Zeile nicht i = int(input("Enter the number of generations you want the model to run for (must be between 5 and 25 inclusive")):

  • ), die nicht bei print("setting the generation 0 values"))
  • gleich sein sollten bei 48 sein soll, ist sehr nützlich :)

    Festgelegte Version:

    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 
    
  • 0

    das ist, was Ich habe so weit getan

    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 
    
    Verwandte Themen