Sichanov

graduation

May 15th, 2021
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. student_name = input()
  2. bad_grade_counter = 0
  3. grade_counter = 1
  4. sum_grades = 0
  5. is_excluded = False
  6. while grade_counter <= 12:
  7.     grade_for_year = float(input())
  8.     if grade_for_year < 4:
  9.         bad_grade_counter += 1
  10.         if bad_grade_counter == 2:
  11.             is_excluded = True
  12.             break
  13.         else:
  14.             continue
  15.     grade_counter +=1
  16.     sum_grades += grade_for_year
  17. average_grade = sum_grades / 12
  18. if is_excluded:
  19.     print(f"{student_name} has been excluded at {grade_counter} grade")
  20. else:
  21.     print(f"{student_name} graduated. Average grade: {average_grade:.2f}")
Advertisement
Add Comment
Please, Sign In to add comment