python - Difficulty in creating program for admission in schools -


i had made project program functions easy way apply admission in school. far, went kinda okay not getting proper output.

what should getting when student name entered admission class(i.e, t2/t1) should checked if there available seats , suitably either enter student or not. when search student student name id number must displayed. when delete student, must class list well.

please material posted below , me.

def search(t2):    t2=(('xxx',1),('yyy',2),('zzz',3))    s=input('enter student id=')    in range(len(t2)):        ch in t2:            if ch==s:                print'student =>',t2[i],'of id number',t2[i+1]                break    else:        print'invalid entry, try again'   def details(t1):        n=raw_input('enter applicant name=')        t2=(('xxx',1),('yyy',2),('zzz',3))        in range(len(t1)):            if len(t1)<5:                t2=t2+(n,i)                break            elif len(t1)==5:                print'sorry, class full'            else:                print'sorry, class full'        print'student added class'    def delete(t2):        l=list(t2)        j=input('enter student id=')        in range(len(t2)):            ch in l:                if j==ch:                    del l[i]                    del l[i+1]                    break                else:                    print'student not found. please try again'        print tuple(l)    n=input('enter number of students=')    t1=tuple()    t2=(('xxx',1),('yyy',2),('zzz',3))     name=raw_input('enter student name=')    idn=input('enter id no.=')    in range(n):        t1=t1+(name,)        t1=t1+(idn,)    while true:        print'\n\n\t\t----admission menu----'        print'\t\t1->apply admission'        print'\t\t2->search student'        print'\t\t3->remove student'        print'\t\t4->exit'         ch=input('enter choice=')        if ch==1:            details(t1)        elif ch==2:            search(t1)        elif ch==3:            delete(t1)        elif ch==4:            print'thank visiting --school name--'            exit()        else:            print'wrong choice, please select valid choice , try again' 

this kind of problem usage of database much. tasks insert, search, delete standard that. easy , modern solution use mongodb pymongo (for python integration).

otherwise, in function search, overwrite t2 directly @ beginning. not sure if intended, if yes have no idea how should work.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -