In: Computer Science
question1:
students' scores:
mark: 81
john: 99
smith: 66
Meggie: 100
terry: 20
William: 65
a. Modify the student's score program so that it reads the exam scores into a queue and prints the queue.
–Next, filter out any exams where the student got a score of 100.
–Then perform your previous code of reversing and printing the remaining students.
b. What if we want to further process the exams after printing?
n = input("Enter number of students:")
n = int(n)
names=[]
marks=[]
for i in range(n):
names.append(input("\nEnter Name of student:"))
marks.append(int(input("Enter Marks:")))
print("\n***Printing the Queue***")
print("Names = ",names)
print("Marks = ",marks)
print("\n***After removing exams with 100 marks**")
for i in range(n):
if(marks[i]==100):
marks.pop(i)
names.pop(i)
print("Names = ",names)
print("Marks = ",marks)
Answer for part b
You can perform any further operations with the data as it is stored in the Queue. The only concern will be that ce cannot retain the data related to the exams with 100 marks as we have already deleted them.
Note:
The above question was a bit less informatory regarding what exact operations are to be performed. So if anything is not satisfactory then get back through comments and I will try to reply as soon as possible.
Thank you.