def main():
print("This program inputs and stores marks
for 30 students who have took 3 tests, out of 20,25 and 35
marks.")
names = []
test_1_score = []
test_2_score = []
test_3_score = []
totalscore = []
studentn = 1
amountofstudents = 3
while studentn <= amountofstudents:
while True:
try:
name = input("Student Name: ")
names.append(name)
test1 = 100
while test1 >20:
test1 = int(input("Student's score test 1 : "))
if test1 >20:
print("Max mark is 20")
test_1_score.append(test1)
test2 = 100
while test2 >25:
test2 = int(input("Student's score test 2 : "))
if test2 >25:
print("Max mark is 25")
test_2_score.append(test2)
test3 = 100
while test3 >35:
test3 = int(input("Student's score test 3 : "))
if test3 >35:
print("Max mark is 35")
test_3_score.append(test3)
totalscorevalue = test1+test2+test3
totalscore.append(totalscorevalue)
break
except ValueError:
print("Invalid entry, please input valid Value")
studentn +=1
show = int(input("Do you want to see the arrays?"))
if show == 1:
print(names)
print(test_1_score)
print(test_2_score)
print(test_3_score)
print(totalscore)
count = 0
while count < amountofstudents:
print(names[count],"'s Total Score is: ",totalscore[count])
count+=1
count = 0
averagescore = 0
while count < amountofstudents:
averagescore = averagescore + totalscore[count]
count+=1
averagescore = (averagescore/amountofstudents)
print("The average score of the class is: ",averagescore)
value = 0
for i in range(0,(amountofstudents-1)):
if int(totalscore[i]) >= value:
value = totalscore[i]
name_slot = i
i+=1
print(names[name_slot]," has the highest score of the class with ", value," marks.")
print("This program inputs and stores marks
for 30 students who have took 3 tests, out of 20,25 and 35
marks.")
names = []
test_1_score = []
test_2_score = []
test_3_score = []
totalscore = []
studentn = 1
amountofstudents = 3
while studentn <= amountofstudents:
while True:
try:
name = input("Student Name: ")
names.append(name)
test1 = 100
while test1 >20:
test1 = int(input("Student's score test 1 : "))
if test1 >20:
print("Max mark is 20")
test_1_score.append(test1)
test2 = 100
while test2 >25:
test2 = int(input("Student's score test 2 : "))
if test2 >25:
print("Max mark is 25")
test_2_score.append(test2)
test3 = 100
while test3 >35:
test3 = int(input("Student's score test 3 : "))
if test3 >35:
print("Max mark is 35")
test_3_score.append(test3)
totalscorevalue = test1+test2+test3
totalscore.append(totalscorevalue)
break
except ValueError:
print("Invalid entry, please input valid Value")
studentn +=1
show = int(input("Do you want to see the arrays?"))
if show == 1:
print(names)
print(test_1_score)
print(test_2_score)
print(test_3_score)
print(totalscore)
count = 0
while count < amountofstudents:
print(names[count],"'s Total Score is: ",totalscore[count])
count+=1
count = 0
averagescore = 0
while count < amountofstudents:
averagescore = averagescore + totalscore[count]
count+=1
averagescore = (averagescore/amountofstudents)
print("The average score of the class is: ",averagescore)
value = 0
for i in range(0,(amountofstudents-1)):
if int(totalscore[i]) >= value:
value = totalscore[i]
name_slot = i
i+=1
print(names[name_slot]," has the highest score of the class with ", value," marks.")