Advertisement
Spocoman

Credit System

Sep 23rd, 2023
986
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. n = int(input())
  2.  
  3. totalGrades = 0.0
  4. totalCredits = 0.0
  5.  
  6. for i in range(n):
  7.     number = int(input())
  8.     grade = number % 10
  9.     credit = int(number / 10)
  10.  
  11.     totalGrades += grade
  12.  
  13.     if grade == 2:
  14.         credit = 0
  15.     elif grade == 3:
  16.         credit *= 0.50
  17.     elif grade == 4:
  18.         credit *= 0.70
  19.     elif grade == 5:
  20.         credit *= 0.85
  21.  
  22.     totalCredits += credit
  23.  
  24. print(f"{totalCredits:.2f}\n{totalGrades / n:.2f}")
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement