Advertisement
ALEXANDAR_GEORGIEV

graduation

May 25th, 2022 (edited)
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. check_count = 12
  2. x = 0
  3. list_grade = []
  4. list_low_grade = []
  5. aver_list_low_grade = 0.0
  6. a = True
  7. y = 0.0
  8. name = input()
  9. while check_count != 0:
  10.     grade = float(input())
  11.     if list_low_grade:  # Лошия списък не е празен
  12.         list_grade.pop()
  13.         list_grade.append(grade)
  14.         if grade < 4:
  15.             a = False
  16.             break
  17.         else:
  18.             list_low_grade = []
  19.  
  20.     list_grade.append(grade)
  21.  
  22.     if grade < 4:
  23.         list_low_grade.append(grade)
  24.     else:
  25.         check_count -= 1
  26. sum_list_grade = sum(list_grade)
  27. len_list_grade = len(list_grade)
  28.  
  29. average_grade = sum_list_grade / len_list_grade
  30. if a:
  31.     print(f"{name} graduated. Average grade: {average_grade:.2f}")
  32. else:
  33.     print(f"{name} has been excluded at {len_list_grade} grade")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement