Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- count = int(30)
- #This was made to calculate 30 students' marks, in order to change amount of input needed,change value in count.
- print("Each will be entered one per line")
- scoreList = []
- nameList=[]
- for i in range (1, count+1):
- nameList.append(input("Enter Name:"))
- while True:
- if all(x.isalpha() or x.isspace() for x in nameList[i-1]):
- break
- del (nameList[i-1])
- nameList.append(input("Please enter letters only:"))
- while True:
- try:
- scoreList.append(int(input("Enter Computer Science Marks:")))
- while (scoreList[i-1]) >100 or (scoreList[i-1])<0:
- del (scoreList[i-1])
- scoreList.append(int(input("Please Retry with a valid number:")))
- break
- except ValueError:
- print("PLease Retry with a Valid number:")
- fmt = '{:<30}{:<20}'
- print(fmt.format("Name Entered:","Comp Science Marks Entered:"))
- for g, (name, score) in enumerate(zip(nameList, scoreList)):
- print(fmt.format(name, score))
- print("Thank you the results are:")
- mysum = sum(scoreList)
- average = 1.0*mysum / count
- print ("Total : ",str(mysum))
- print ("Average: ",str(average))
- print ("Lowest : ",str(min(scoreList)))
- print ("Highest: ",str(max(scoreList)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement