Sichanov

dd

Aug 2nd, 2021
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. name_of_student = input("")
  2. grade_n = 1
  3. bad_notes = 0
  4. avg_grade = 0
  5. sum = 0
  6.  
  7. while grade_n <= 12:
  8.     grade = float(input())
  9.     if grade < 4.00:
  10.         bad_notes += 1
  11.         if bad_notes > 1:
  12.             print(f"{name_of_student} has been excluded at {grade_n} grade")
  13.             break
  14.     else:
  15.         grade_n += 1
  16.         sum += grade
  17.  
  18. if bad_notes < 2:
  19.     avg_grade = sum / 12
  20.     print(f"{name_of_student} graduated. Average grade: {avg_grade:.2f}")
  21.  
Advertisement
Add Comment
Please, Sign In to add comment