2016-11-30 9 views
0

Ich versuche, ein Menü für meine GCSE-Arbeit zu programmieren, aber am Ende habe ich einen Syntaxfehler im Semikolon. Hier ist das Programm unter:Syntaxfehler auf dem Semikolon?

def choice() : 
    print = ("Welcome to the troubleshooting System") 
    print = ("") 
    print = ("a. Samsung") 
    print = ("") 
    print = ("b. Android") 
    print = ("") 
    print = ("c. Apple") 
    print = ("") 
    print = ("d. Blackberry") 
    print = ("") 
    print = ("e. Sony") 
    choice_input = input(str(" Please select the letter of the brand of phone that you are using") 

         if choice_input == "a": 
         Samsung() 

         elif choice_input == "b": 
          Android() 

         elif choice_input == "c": 
          Apple() 

         elif choice_input == "d": 
          Blackberry() 

         elif choice_input == "e": 
          Sony() 

ich glaube, das Problem ist bei dem 'wenn choice_input == "a":' Bitte um Hilfe!

+0

Haben Sie diese Funktionen erstellt, die Sie in Ihren 'if' Anweisungen aufrufen? – Inconnu

+0

Einrückung zählt in Python, 'Samsung()' sollte eingerückt werden, damit es zu der passenden 'if' Anweisung gehört, auch wenn Sie sagen, dass Sie einen Fehler haben, sollten Sie in die Frage einfügen, in welcher Zeile Sie den Fehler – EdChum

+0

' print = erhalten ("Zeug") '?? Technisch gesehen ist das nicht inkorrekt, aber es tut nicht, was Sie erwarten. – ForceBru

Antwort

0

Sie haben ein paar Fehler gemacht, hauptsächlich die Druckfunktionen. Warum machen Sie Druckvariablen, statt die Druckanweisungen aufzurufen? Hier aussehen:

import time 
import sys 
#The program boots up 
print("Loading...") 
time.sleep(2) 
# 'Def' allows this program to present a menu toward the user in which he can decide what phone 

def choice() : 
    print ("Welcome to the troubleshooting System") 
    print ("") 
    print ("a. Samsung") 
    print ("") 
    print ("b. Android") 
    print ("") 
    print ("c. Apple") 
    print ("") 
    print ("d. Blackberry") 
    print ("") 
    print ("e. Sony") 
    choice_input = input(str(" Please select the letter of the brand of phone that you are using")) 
    if choice_input == "a": 
     Samsung() 

    elif choice_input == "b": 
     Android() 

    elif choice_input == "c": 
     Apple() 

    elif choice_input == "d": 
     Blackberry() 

    elif choice_input == "e": 
     Sony() 

choice()#call the function to start/execute 
+0

Ich denke, ich verstehe, was ich falsch ging Achilles, Danke! –

Verwandte Themen