We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Loading...
  • Practice
  • Compete
  • Jobs
  • Leaderboard
  1. Practice
  2. Algorithms
  3. Implementation
  4. Grading Students
  5. Discussions

Grading Students

  • Problem
  • Submissions
  • Leaderboard
  • Discussions
  • Editorial

    You are viewing a single comment's thread. Return to all comments →

  • franchetti 2 years ago+ 2 comments

    Could be condensed to a single condition if you wanted.

    if grade >= 38:
        if grade % 5 > 2:
            grade += 5 - (grade % 5)
    print(grade)
    
    13|
    ParentPermalink
    • iabhayt 1 year ago+ 0 comments

      thanks :)

      0|
      ParentPermalink
    • lvsz_ 12 months ago+ 0 comments

      That's two, and it could be condensed to none if you wanted.

      print((grade, grade - (grade % -5))[grade >= 38 and grade % 5 > 2])
      
      -3|
      ParentPermalink
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature