Advertisement
HristoBaychev

Graduation

Feb 7th, 2023
625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. name_student = input()
  2. number_of_class = 0
  3. average = 0
  4. sum_of_evaluation = 0
  5. count_fail = 0
  6.  
  7. while number_of_class < 12:
  8.     evaluation = float(input())
  9.  
  10.     if 4 <= evaluation <= 6:
  11.         sum_of_evaluation += evaluation
  12.         number_of_class += 1
  13.     elif 2 <= evaluation < 4.00:
  14.         count_fail += 1
  15.  
  16.     if count_fail == 2:
  17.         break
  18.  
  19.  
  20. if count_fail == 2:
  21.     print(f'{name_student} has been excluded at {number_of_class+1:.0f} grade')
  22. else:
  23.     average = sum_of_evaluation / number_of_class
  24.     print(f'{name_student} graduated. Average grade: {average:.2f}')
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement