I am currently working on a code and there are three tasks. I am struggling on the last task - I have rearched alot and asked my teachers, i'v tried a variety of codes but there hasnt been any luck.
Here is the task:
complete all tasks and provide evidence to meet all the marking criteria.
For the following scenario analyse the detailed requirements for each situation and, using suitable
algorithms, design a solution to be coded in a suitable high-level programming language. Show the
iterative development of the individual solutions with suitable testing throughout the process. Test
the final products and evaluate your solutions against the detailed requirements you identified in the
analysis.
The results for a task may be used without further testing in any subsequent task, or each of the tasks
may be solved as a separate system.
Arithmetic quiz

Task 1
A primary school teacher wants a computer program to test the basic arithmetic skills of her students.
The program should generate a quiz consisting of a series of random questions, using in each case
any two numbers and addition, subtraction and multiplication. The system should ask the student’s
name, then ask 10 questions, output if the answer to each question is correct or not and produce a final
score out of 10.
Analyse the requirements in detail and design, code, test and evaluate a program to meet these
requirements.
Task 2
The teacher wants to keep track of the scores each member of the class obtains in the quiz. There are
three classes in the school and the data should be kept separately for each class.
Analyse the requirements in detail for this program and design, code, test and evaluate a program that
will record and store the data for three separate classes of students using the arithmetic quiz.
Task 3
The teacher wants to use the results from students taking these quizzes to log their performance. The
system should store the last three scores for each student. The teacher would like to be able to output
the results of the quiz for a particular class, sorted:
• in alphabetical order with each student’s highest score for the tests
• by the highest score, highest to lowest
• by the average score, highest to lowest.
Analyse the requirements in detail for this program and design, code, test and evaluate a program that
will allow the teacher to select which class group to look at and which field to use when sorting the
output data.

Here is the code i started of with: which is task 1 and task 2
I need help on task 3
There are some errors on task 2.
Anybody to help with the code please:)

import random
print("Please enter your name") 
name = input()
from random import randint
correct = 0
n1 = randint(1,20)
n2 = randint(1,20)
dub = str(n1 + n2)
question = input(" 1) what is " + str(n1) + " + " + str(n2) + "?") 
ans = input()
if ans == dub:
    print("Thats right -- well done.\n")
    correct = correct + 1
else:
     print ("Sorry that is incorrect, the answer is",dub)
x1 = randint(1,10)
x2 = randint(1,10)
dub = str(x1 + x2)
question = input("2) what is " + str(x1) + " + " + str(x2) + "?")
ans = input()
if ans == dub:
    print("Thats right -- well done.\n") 
    correct = correct + 1
else:
     print ("Sorry that is incorrect, the answer is",dub)    
y1 = randint(1,30)
y2 = randint(1,30)
dub = str(y1 - y2)
question = input("3) what is " + str(y1) + " - " + str(y2) + "?")
ans = input()
if ans == dub:
    print("Thats right -- well done.\n")
    correct = correct + 1
else:
     print ("Sorry that is incorrect, the answer is",dub)
z1 = randint(1,100)
z2 = randint(1,100) 
dub = str(z1 * z2)
question = input("4) what is " + str(z1) + " * " + str(z2) + "?")
ans = input()
if ans == dub:
    print("Thats right -- well done.\n")
    correct = correct + 1
else:
     print ("Sorry that is incorrect, the answer is",dub)
f1 = randint(1,10)
f2 = randint(1,10)
dub = str(f1 - f2)
question = input("5) what is " +  str(f1)  + " - " + str(f2) + "?")
ans = input()
if ans == dub:
    print("Thats right -- well done.\n")
    correct = correct + 1

else:
     print ("Sorry that is incorrect, the answer is",dub)
a1 = randint(1,45)
a2 = randint(1,45)
dub = str(a1 * a2)
question = input("6) what is " +  str(a1)  + " * " + str(a2) + "?")
ans = input()
if ans == dub:
    print("Thats right -- well done.\n") 
    correct = correct + 1
else:
     print ("Sorry that is incorrect, the answer is",dub)    
b1 = randint(1,15)
b2 = randint(1,15)
dub = str(b1 + b2)
question = input("7) what is " +  str(b1) + " + " + str(b2) + "?")

ans = input()
if ans == dub:
    print("Thats right -- well done.\n")
    correct = correct + 1
else:
     print ("Sorry that is incorrect, the answer is",dub)

z1 = randint(1,30)
z2 = randint(1,30)
dub = str(z1 - z2)
question = input("8) what is " + str(z1) + " - " + str(z2) + "?")
ans = input()
if ans == dub:
    print("Thats right -- well done.\n")
    correct = correct + 1
else:
     print ("Sorry that is incorrect, the answer is",dub)
k1 = randint(1,20)
k2 = randint(1,20)
dub = str(k1 - k2)
question = input("9) what is " + str(k1) + " - " + str(k2) + "?")
ans = input()

if ans == dub:
    print("Thats right -- well done.\n")

    correct = correct + 1
else:
     print ("Sorry that is incorrect, the answer is",dub)

s1 = randint(1,40)
s2 = randint(1,20)
dub = str(s1 - s2)

question = input("10) what is " + str(s1) + " - " + str(s2) + "?")
ans = input()
if ans == dub:
    print("Thats right -- well done.\n")
    correct = correct + 1
else:
     print ("Sorry that is incorrect, the answer is",dub) 
print("\nYou got",correct, " out of 10.")

student_class=input("what class are you in?")
if student_class == "class1":
    file=open("class 1.csv", "a+")
if student_class == "class2":
    file=open("room2.csv", "a+")
if student_class == "class3":
    file=open("class3.csv", "a+")

Name = input ("Enter  Name: ")
score1= input ("Enter the score 1 results: ")
score2= input ("Enter the score 2 results: ")
score3= input ("Enter the score 3 results: ")

new_record = Name+","+score1 +","+score2 +","+score3
file.write(new_record)
file.write("\n")

file.close()

I think you are still here:

Show the
iterative development of the individual solutions with suitable testing throughout the process. Test
the final products and evaluate your solutions against the detailed requirements you identified in the
analysis.

I see no indication that this is the case i.e. that your program fulfills the requirements and of your testing methodology.

im doing the same code and it would be very benifical if anyone could finish off this code.

No, it would not be benificial at all. Cheating by using someone else's answers is an insult to the original author and an insult to your teacher.
Do your own homework.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.