In: Computer Science
create a program using IDLE where you will gather input from the user using a loop. The user needs to provide you with a list of test scores for two categories (two different classrooms). Test scores must be integer values between 0 and 10. You need to process each score so that you can output the following:
Number of test scores entered for classroom A.
Number of test scores entered for classroom B.
Average of test scores entered for classroom A.
Average of test scores entered for classroom B.
Here is the required solution
here is the code
#variable declaration
suma=0
sumb=0
counta=0
countb=0
#take user input for class A
while(1):
c=int(input("Enter test score for class A:"))
suma+=c
counta+=1
c=input("Enter 1 to enter more test score and 0 to quit:")
if c=='0':
break
#take user input for class B
while(1):
c=int(input("Enter test score for class B:"))
sumb+=c
countb+=1
c=input("Enter 1 to enter more test score and 0 to quit:")
if c=='0':
break;
#display the results
print("Number of testscore entered for classroom A.",counta)
print("Number of testscore entered for classroom B.",countb)
print("Average of testscore entered for classroom
A.",suma/counta)
print("Average of testscore entered for classroom
B.",sumb/countb)