Advertisement
IraT

Untitled

Dec 12th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. user_score = float(input('Enter your grade:'))
  2.  
  3. def return_grade(user_input):
  4. try:
  5. if user_score > 1.0 or user_score < 0.0 :
  6. return ('Please enter a number between 0.0 and 1.0')
  7.  
  8. elif user_score >= 0.9 :
  9. return 'A'
  10. elif user_score >= 0.8 :
  11. return 'B'
  12. elif user_score >= 0.7 :
  13. return 'C'
  14. elif user_score >= 0.6 :
  15. return 'D'
  16. elif user_score < 0.6 :
  17. return 'F'
  18. except VelueError:
  19. print('Please enter a number')
  20.  
  21. print(return_grade(user_input))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement