Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- classAlist=[]
- classBlist=[]
- nameAlist=[]
- nameBlist=[]
- nameABlist=[]
- scoreAlist=[]
- scoreBlist=[]
- markListAB=[]
- nameListAB=[]
- scoreListAB=[]
- bottom_score = 0
- top_score = 100
- count=0
- import sys
- global count
- def addListAB():
- nameListAB.append(name)
- markListAB.append(mark)
- #----------------------------------------------------------------------------------------------------------------
- def Average():
- average = sum(markListAB)/len(markListAB)
- print("The average mark of both classes is :",average)
- #----------------------------------------------------------------------------------------------------------------
- def Top3():
- top3A = sorted(zip(classAlist,nameAlist))[:3]
- top3B = sorted(zip(classBlist,nameBlist))[:3]
- print("Top three in A is :", top3A)
- print("Top three in B is :", top3B)
- #----------------------------------------------------------------------------------------------------------------
- def deletionA():
- whichone=str(input("Which name would you like to delete?")).lower()
- scoreremove=int(input("Please enter the corressponding score too"))
- deleteAname()
- deleteAscore()
- def deletionB():
- whichone2=str(input("Which name would you like to delete?")).lower()
- scoreremove2=int(input("Please enter the corressponding score too"))
- deleteBname()
- deleteBscore()
- #-------------------------------------------------------------------------------------------------------------
- def enter():
- illegalScore = mark > top_score or mark < bottom_score
- EXCELLENCE = 80
- MERIT = 60
- ACHIEVED = 40
- if illegalScore:
- print(mark,"is not a legal exam score")
- else:
- if mark >= EXCELLENCE:
- print("Mark of ", mark, " : Excellent")
- elif mark >= MERIT:
- print("Mark of ", mark, " : Merit")
- elif mark >= ACHIEVED:
- print("Mark of ", mark, " : Achieved")
- elif mark < ACHIEVED and mark > 0:
- print("Mark of ", mark, " : Not Achieved")
- else:
- print("Mark of ",mark, " : Absent")
- #-------------------------------------------------------------------------------------------------------------
- def deleteAname():
- try:
- nameAlist.remove(whichone)
- except ValueError:
- pass
- def deleteAscore():
- try:
- classAlist.remove(scoreremove)
- except ValueError:
- pass
- def deleteBname():
- try:
- nameBlist.remove(whichone2)
- except ValueError:
- pass
- def deleteBscore():
- try:
- classBlist.remove(scoreremove2)
- except ValueError:
- pass
- #-------------------------------------------------------------------------------------------------------------
- def addingtolistA():
- classAlist.append(grade)
- nameAlist.append(name)
- scoreAlist.append(mark)
- def addingtolistB():
- classBlist.append(grade)
- nameBlist.append(name)
- scoreBlist.append(mark)
- #-------------------------------------------------------------------------------------------------------------
- def inputs():
- global name, score, mark, classs, grade
- classs=str(input("Please enter the student's class (a or b) or press enter to go to deletion")).lower()
- if classs=="a":
- try:
- name=(input("Please enter the name of the student"))
- mark = int(input("What was your exam mark? "))
- except Value error:
- print ("not a number please enter a valid response!!")
- grade=mark
- enter()
- addListAB()
- addingtolistA()
- print ("class A:",nameAlist)
- print ("class A:",classAlist)
- if classs=="b":
- name=(input("Please enter the name of the student"))
- mark = int(input("What was your exam mark? "))
- grade=mark
- enter()
- addingtolistB()
- addListAB()
- print ("class B:",nameBlist)
- print ("class B:",classBlist)
- answer=""
- answer=str(input("Would you like to put in another student?(Yes or No) or press enter to go to deletion"))
- if answer=="yes":
- inputs()
- if answer=="no":
- print ("Thanks for entering in your names!")
- #-------------------------------------------------------------------------------------------------------------
- answer=""
- answer=str(input("Would you like to put in a new student?(type Yes or press anything else to end the program)"))
- if answer=="yes":
- inputs()
- else:
- print ("Thanks for using this program!")
- response=str(input("Would you like to delete a value? Yes/No")).lower()
- if response =="no":
- Average()
- Top3()
- classresponse=str(input("What class is the person from? a/b")).lower()
- if classresponse=="a" and response=="yes":
- deletionA()
- print (nameAlist)
- print (classAlist)
- if classresponse=="b" and response=="yes":
- deletionB()
- print (nameBlist)
- print (classBlist)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement