vendredi 31 mars 2017

errors with Elif expected indented block

I'm trying to create a menu for my application, the menu has 4 options and each of these options should return with the correct information when the user has entered the chosen value. i keep getting an error with the Elif statements. I am a newbie so please understand where am coming from. much appreciation.

when i indent the while ans: i will receive an error says invalid syntax after indenting the elif ans==2.

elif ans==2 <--- this error keeps saying indention block error or syntex invalid when i indent it.

def print_menu(self,car):
print ("1.Search by platenumber") print ("2.Search by price ") print ("3.Delete 3") print ("4.Exit 4")

loop=True
while loop: print_menu() ans==input("Please choose from the list")

    if ans==1:
        print("These are the cars within this platenumber")
    return platenumber_

    while ans:  
        if ans==2:
        elif ans==2:
            print("These are the prices of the cars")
    return price_   

    elif ans==3:
        print("Delete the cars ")
    return delete_ 

    elif  ans==4:
    return Exit_  

            loop=False

    else:
        raw_input("please choose a correct option")

Aucun commentaire:

Enregistrer un commentaire