DiYane

Bonus Scoring System

Sep 18th, 2023
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. import math
  2. students_count = int(input())
  3. lectures_count = int(input())
  4. additional_bonus = int(input())
  5.  
  6. max_bonus = 0
  7. total_bonus = 0
  8.  
  9. if lectures_count == 0:
  10.     print(f'Max Bonus: 0.')
  11.     print(f'The student has attended 0 lectures.')
  12. else:
  13.     max_bonus_attendances = 0
  14.     for student in range(students_count):
  15.         attendances = int(input())
  16.         total_bonus = attendances / lectures_count * (5 + additional_bonus)
  17.         if total_bonus >= max_bonus:
  18.             max_bonus = total_bonus
  19.             max_bonus_attendances = attendances
  20.  
  21.     print(f'Max Bonus: {math.ceil(max_bonus)}.')
  22.     print(f'The student has attended {max_bonus_attendances} lectures.')
Tags: python
Add Comment
Please, Sign In to add comment