Sichanov

ggg

Jul 31st, 2021
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. name_of_student = input()
  2.  
  3. sum_grades = 0.0
  4. average_grade = 0.0
  5. excluded = 0
  6. class_of_student = 1
  7.  
  8. while class_of_student <= 12:
  9.     grade = float(input())
  10.  
  11.     if grade >= 4:
  12.         class_of_student += 1
  13.         sum_grades += grade
  14.     else:
  15.         excluded += 1
  16.  
  17.         if excluded > 1:
  18.             print(f'{name_of_student} has been excluded at {class_of_student} grade ')
  19.             break
  20.  
  21. if excluded < 2:
  22.     average_grade = sum_grades / 12
  23.     print(f'{name_of_student} graduated. Average grade: {average_grade:.2f}')
Advertisement
Add Comment
Please, Sign In to add comment