Advertisement
SimeonTs

SUPyF2 Functions-Lab - 01. Grades

Oct 8th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. """
  2. Functions - Lab
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1727#0
  4.  
  5. SUPyF2 Functions-Lab - 01. Grades
  6.  
  7. Problem:
  8. 1.  Grades
  9. Write a function that receives a grade between 2.00 and 6.00 and prints the corresponding grade in words
  10. • 2.00 – 2.99 - "Fail"
  11. • 3.00 – 3.49 - "Poor"
  12. • 3.50 – 4.49 - "Good"
  13. • 4.50 – 5.49 - "Very Good"
  14. • 5.50 – 6.00 - "Excellent"
  15.  
  16. Examples:
  17. Input:  Output:
  18. 3.33    Poor
  19. 4.50    Very Good
  20. 2.99    Fail
  21. """
  22.  
  23.  
  24. def grades(score):
  25.     if 2.00 <= score <= 2.99:
  26.         return "Fail"
  27.     elif 3.00 <= score <= 3.49:
  28.         return "Poor"
  29.     elif 3.50 <= score <= 4.49:
  30.         return "Good"
  31.     elif 4.50 <= score <= 5.49:
  32.         return "Very Good"
  33.     elif 5.50 <= score <= 6.00:
  34.         return "Excellent"
  35.  
  36.  
  37. print(grades(float(input())))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement