Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- num_students= int(input("How many students are in the class? - "))
- while num_students <= 0:
- print("Sorry, that number of students is invalid.")
- num_students= int(input("How many students are in the class? - "))
- num_tests= int(input("How many tests were in this class? - "))
- while num_tests <= 0:
- print("Sorry, not valid number of tests.")
- num_tests= int(input("How many tests were in this class? - "))
- student_score= 0
- total_score=0
- for student_count in range(num_students):
- print("Student %2d: " % (student_count+1))
- for test_count in range(num_tests):
- grade= float(input("Score on test%2d " %(test_count+1)))
- while grade <=0:
- print("Sorry, invalid input for test grade!")
- grade= float(input("Score on test%2d " %(test_count+1)))
- student_score+= grade
- total_score+= grade
- student_avg= student_score/num_tests
- print("Average score for the student %2d = %5.2f"%(student_count+1,student_avg))
- total_avg_score= total_score/(num_tests*num_students)
- print(total_score)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement