mercredi 3 février 2021

Syntax error occurring while trying to make drop down menu in python 3.8 idle

Guys this is the code

def menu ():
    while True :
    
    print('1.Display Content Of CSV File')
    
    print('2.Display Maximum Mark In  Each Subject')
    
    print('3.Display Minimum Mark In  Each Subject')
    
    print('4.Average Mark Scored By Each Student')
    
    print('5.Display The Mean Value For Column IP')
    
    print('6.Display The Average Mark Of Each Subject')
    
    print('7.Display The Name Of Students And Accountancy Marks')
    
    print('8.Create A CSV File From The Given Dataframe to Store The Marks Of Economics and Accountancy')
    
    print('9.Exit')
    
    
    choice=int(input('Enter Your Choice :'))
    
    if choice==1 :
        import pandas as pd
        df=pd.read_csv('IP Project-1.csv')
        print(df)
         
    elif choice==2 :
        import pandas as pd
        df=pd.read_csv('IP Project-1.csv',usecols=['MAX'])
        print(df)
    
    elif choice==3 :
        import pandas as pd
        df=pd.read_csv('IP Project-1.csv',usecols=['MIN'])
        print(df)
    
    elif choice==4 :
        import pandas as pd
        df=pd.read_csv('IP Project-1.csv',usecols=['Average'])
    print (df)
    
    ***elif choice==5 :
        import pandas as pd
        df=pd.read_csv('IP Project-1.csv',usecols=['AVERAGE'])
    print(df.iloc[0:1])
    print (df)
    elif choice==6 :
    import pandas as pd
        df=pd.read_csv('IP Project-1.csv',usecols=['AVERAGE'])
    print(df)
    elif choice==7 :
    import pandas as pd
        df=pd.read_csv('IP Project-1.csv',usecols=['Name','Accountancy'])
    print(df)
    elif choice==8 :
    import pandas as pd
        df= Pandas to_csv('IP Project-1.csv',usecols=['Name','Accountancy','Economics'])
    print(df)
    elif choice==9 :
           break
    else :
        break
    print('Exit')

while making this program syntax error is happening from elif choice==5 :

Can you guys help me to fix this error?

Aucun commentaire:

Enregistrer un commentaire