Weird grading system

14

Weirdo Incorporates have a weird way of grading their staffs by the number of days they were present in the office:

  0 -  13 : F  
 14 - 170 : E
171 - 180 : D
181 - 294 : C
295 - 300 : B
301 - 365 : A

Note: The range is inclusive (i.e. 0-13 means 0 days and 13 days both will evaluate
as grade 'F').

Objective:

Write a program/function that outputs/returns the grade of an employee for the number of days [within inclusive range of 0-365] attended by the employee.

Rules:

  • You may take input as a string or a number but must output as a string/alphabet (You may choose either lower or upper-case.)
  • Standard loopholes apply.
  • This is , so the shortest program in bytes wins!

Test cases:

12  => F
15  => E
301 => A
181 => C

Scoreboard:

var QUESTION_ID=142243,OVERRIDE_USER=8478;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){var F=function(a){return a.lang.replace(/<\/?a.*?>/g,"").toLowerCase()},el=F(e),sl=F(s);return el>sl?1:el<sl?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>

officialaimm

Posted 2017-09-09T13:53:59.333

Reputation: 2 739

sandbox – officialaimm – 2017-09-09T13:55:12.720

1Closely related – Mr. Xcoder – 2017-09-09T14:00:12.293

Not sure if it is a duplicate, since the strings there are much longer. – Mr. Xcoder – 2017-09-09T14:06:21.363

4Closer related – H.PWiz – 2017-09-09T14:09:39.143

Will we get input over 365? – Erik the Outgolfer – 2017-09-09T14:12:24.313

1@Mr.Xcoder I recall that it was discussed in the sandbox that it's not a dupe of that since this doesn't have equal-sized ranges and that having suffixes such as +/-. – Erik the Outgolfer – 2017-09-09T14:20:17.373

@EriktheOutgolfer Ok. Retracted – Mr. Xcoder – 2017-09-09T14:21:20.313

@EriktheOutgolfer The input will be less than 366. – officialaimm – 2017-09-09T14:31:49.603

1Can we get a scoreboard? – jrtapsell – 2017-09-09T17:55:18.090

@jrtapsell Added – officialaimm – 2017-09-10T07:25:47.607

The fact that the test cases don't spell FACE annoys me more than it should. – Magic Octopus Urn – 2018-03-02T18:08:34.173

Answers

4

Jelly,  18 17 15  14 bytes

NịØAx“A©r½ɗÇ‘¤

A monadic link taking a number and returning a character.

Try it online! or see all input-output pairs.

How?

NịØAx“A©r½ɗÇ‘¤ - Link: number, d
N              - negate d
             ¤ - nilad followed by link(s) as a nilad:
  ØA           -   uppercase alphabet yield = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
     “A©r½ɗÇ‘  -   code-page indices = [65,6,114,10,157,14]
    x          -   times = 'A'x65+'B'*6+'C'x114+'D'x10+'E'*157+'F'*14
 ị             - index into (1-indexed & modular - hence the negation to allow all Fs
                                                   to be together at one end)

Jonathan Allan

Posted 2017-09-09T13:53:59.333

Reputation: 67 804

12

Javascript (ES6), 51 bytes

n=>"ABCDEF"[(n<14)+(n<171)+(n<181)+(n<295)+(n<301)]

Alternative solutions (longer):

53 52 bytes (-1 byte thanks to @Arnauld)

n=>"FEDCBA"[n>300?5:n>294?4:n>180?3:n>170?2:+(n>13)]

55 53 bytes (-2 bytes thanks to @Neil)

n=>"AFEDCB"[[14,171,181,295,301].findIndex(m=>n<m)+1]

55 bytes

n=>"FEDCBA"[[13,170,180,294,300].filter(m=>n>m).length]

Example code snippet:

f=
n=>"ABCDEF"[(n<14)+(n<171)+(n<181)+(n<295)+(n<301)]
console.log(f(12))
console.log(f(15))
console.log(f(301))
console.log(f(181))

Herman L

Posted 2017-09-09T13:53:59.333

Reputation: 3 611

1That summing the conditions thing is great!!! Wish I could upvote once again!!! :D – officialaimm – 2017-09-09T15:02:14.347

I can save two bytes on one of your alternative solutions: n=>"AFEDCB"[[14,171,181,295,301].findIndex(m=>n<m)+1] – Neil – 2017-09-09T16:20:43.747

-1 byte for your first alternative solution: n=>'FEDCBA'[n>300?5:n>294?4:n>180?3:n>170?2:+(n>13)] – Arnauld – 2017-09-09T20:35:44.147

7

TI-Basic, 40 bytes

sub("FEDCBA",sum(Ans≥{0,14,171,181,295,301}),1

Timtech

Posted 2017-09-09T13:53:59.333

Reputation: 12 038

6

J, 31 bytes

'FEDCBA'{~13 170 180 294 300&I.

Try it online!

Explanation

'FEDCBA'{~13 170 180 294 300&I.  Input: n
          13 170 180 294 300     Constant array [13, 170, 180, 294, 300]
                            &I.  Use it with interval index to find which of
                                 the intervals (-∞, 13], (13, 170], (170, 180],
                                 (180, 294], (294, 300], (300, ∞) n can be inserted at
        {~                       Index into
'FEDCBA'                         This string and return that char

miles

Posted 2017-09-09T13:53:59.333

Reputation: 15 654

First time I've seen dyadic I. in the wild. Neat. – cole – 2017-09-09T23:23:12.143

@cole I believe I've used it a couple times in the past in code-golf. – miles – 2017-09-09T23:55:06.563

6

Python 3, 50 bytes

Thanks to @jferard for -4 bytes.

lambda n:chr(70-sum(n>ord(x)for x in"\rª´ĦĬ"))

Try it online!

Python 3, 54 bytes

lambda n:chr(70-sum(n>x for x in[13,170,180,294,300]))

Try it online!

Saved 2 bytes thanks to @mathmandan, and indirectly thanks to @JonathanFrech.

Python 2, 56 bytes

lambda n:"ABCDEF"[sum(n<x for x in[14,171,181,295,301])]

Try it online!

Mr. Xcoder

Posted 2017-09-09T13:53:59.333

Reputation: 39 774

1

54 bytes: lambda n:chr(70-sum(n>x for x in[13,170,180,294,300])). (See answer by @Jonathan Frech at https://codegolf.stackexchange.com/a/142244/36885)

– mathmandan – 2017-09-09T17:21:20.217

150 bytes – jferard – 2017-09-11T07:56:48.677

ruby port: ->n{(70-"ĬĦ´ª\r".chars.count{|i|n>i.ord}).chr} same size – Asone Tuhid – 2018-02-28T23:18:42.993

4

C, 62 61 bytes

Thanks to @Jonathan Frech for saving a byte!

f(n){putchar(70-(n<14?0:n<171?1:n<181?2:n<295?3:n<301?4:5));}

Try it online!

C, 57 bytes

#define f(n)70-(n<14?0:n<171?1:n<181?2:n<295?3:n<301?4:5)

Try it online!

C (gcc), 54 bytes

f(n){n=70-(n<14?0:n<171?1:n<181?2:n<295?3:n<301?4:5);}

Try it online!

C (gcc), 50 bytes

Using @Herman Lauenstein's solution.

f(n){n=65+(n<14)+(n<171)+(n<181)+(n<295)+(n<301);}

Try it online!

Steadybox

Posted 2017-09-09T13:53:59.333

Reputation: 15 798

61 bytes. – Jonathan Frech – 2017-09-09T14:22:11.303

Why not submit the shortest version as your main solution? – Shaggy – 2017-09-10T03:20:34.343

@Shaggy The ones that require gcc resort to undefined behaviour, so I'd rather keep the well defined ones on the top, and sorting them from oldest to newest and at the same time from longest to shortest seems fine to me. – Steadybox – 2017-09-11T15:52:41.333

3

Japt, 23 21 bytes

'Gc-[#ªT#´D294L*3]è<U

Try it


Explantion

Implicit input of integer U.

'Gc-

Subtract from the codepoints of the (single character) string G ...

è<U

The count of elements less than U ...

[#ªT#´D294L*3]

In the array of 170 (), 0 (T), 180 (), 13 (D), 294 (literal) & 300 (L*3), so formatted and ordered to avoid the use of delimiting commas. 0 could be removed (subtracting from the codepoint of F instead) but then a comma would need to be added or C*F (12*15) used for 180, ultimately saving no bytes.

Shaggy

Posted 2017-09-09T13:53:59.333

Reputation: 24 623

3

R, 50 44 bytes

LETTERS[6-sum(scan()>c(13,170,180,294,300))]

Try it online!

same as the javascript answer, but uses R's vectorization and LETTERS builtin to come in a tiny bit shorter.

Thanks to rturnbull for shaving off those last 6 bytes.

Giuseppe

Posted 2017-09-09T13:53:59.333

Reputation: 21 077

49 bytes – rturnbull – 2018-03-01T20:34:14.543

In fact, 44 bytes by just making it a full program instead of a function.

– rturnbull – 2018-03-01T20:38:57.150

@rturnbull ah, I was about to say "no you need to wrap that in cat or else use source(program,ec=T) and count ec=T as a flag (as per the meta consensus on R programs), but by another, newer meta consensus we don't count flags any longer, so I that's a perfectly valid solution. – Giuseppe – 2018-03-01T20:50:30.693

3

Kotlin, 56 bytes

{v->'F'-listOf(13,170,180,294,300).filter{it<v}.count()}

Try it online!

Beautified

{ v->
    // Count the grades passed, then subtract that from F
    'F' - listOf(13,170,180,294,300)
            .filter { it < v }
            .count()
}

Test

var x:(Int)->Char =
{v->'F'-listOf(13,170,180,294,300).filter{it<v}.count()}

fun main(args: Array<String>) {
    println(x(12))
    println(x(15))
    println(x(301))
    println(x(181))
}

jrtapsell

Posted 2017-09-09T13:53:59.333

Reputation: 915

+1. I edited your answer to a more formal format, hope you won't mind. – officialaimm – 2017-09-09T17:52:25.060

Not at all, I meant to fix my tool to output the right header – jrtapsell – 2017-09-09T17:52:54.130

2

Python 2, 77 bytes

lambda n:chr(70-sorted(_*(n>(0,13,170,180,294,300)[_])for _ in range(6))[-1])

Try it online!

Jonathan Frech

Posted 2017-09-09T13:53:59.333

Reputation: 6 681

2

Recursiva, 49 30 bytes

Y(++++<a301<a295<a181<a171<a14

Try it online!

Allow me to answer my own question in my own language. :D

  • saved 19 bytes by using technique from @Herman Lauenstein's amazing JS answer

Explanation:

Y(++++<a301<a295<a181<a171<a14
      <a301<a295<a181<a171<a14 calculate true/false for all the conditions
  ++++                         sum up all the conditions to obtain n which can be either 0,1,2,3,4 or 5
 (                             yield upper-case Alphabet
Y                              Get n-th element   

officialaimm

Posted 2017-09-09T13:53:59.333

Reputation: 2 739

2

Perl 5, 47 + 1 (-p) = 48 bytes

$_=((F)x14,(E)x157,(D)x10,(C)x114,(B)x6)[$_]||A

Try it online!

Xcali

Posted 2017-09-09T13:53:59.333

Reputation: 7 671

Command line flags are free now! – wastl – 2018-03-01T18:31:42.657

2

Pyke, 28 bytes

G6<13T17*180T30*294]5FhQ>)s@

Try it here!

Explanation

G6<13T17*180T30*294]5FhQ>)s@ - Full program. T is the constant for 10.

G                            - The lowercase alphabet.
 6<                          - With the letters after the index 6 trimmed.
   13                        - The literal 13.
     T17*                    - The integer 170, composed by 17 * 10, to save whitespace.
         180                 - The literal 180.
            T30*             - The integer 300, composed by 30 * 10. 
                294          - The literal 294.
                   ]5        - Create a list of 5 elements.
                     FhQ>)   - For each element in the list.
                      h      - Increment.
                       Q     - The input.
                        >    - Is smaller ^^ than ^? Yields 1 for truthy and 0 for falsy.
                         )s  - Close loop and sum.
                           @ - Get the index in the alphabet substring explained above.

Mr. Xcoder

Posted 2017-09-09T13:53:59.333

Reputation: 39 774

1

Jelly, 19 bytes

“n-'‘+⁹;“ỌẠÇ‘ð>SịØA

Try it online!

Footer executes all test-cases and formats the output.

fireflame241

Posted 2017-09-09T13:53:59.333

Reputation: 7 021

1

Pyth, 30 bytes

@GtlfgTQmCdc"\r ª ´ & , m"d

The site doesn't seem to show the character with code point 1, so you need to insert a character with code point 1 before the &, ,, and m at the end

(Replace all 1s with character with code point 1):

@GtlfgTQmCdc"\r ª ´ 1& 1, 1m"d

Karan Elangovan

Posted 2017-09-09T13:53:59.333

Reputation: 179

1

Pyth, 25  26  bytes

@<G6sgRQ[13*17T180*30T294

Verify all the test cases.

Explanation

@<G6sgRQ[13*17T180*30T294 - Full program.

  G                       - The lowercase alphabet.
 < 6                      - With the letters after the index 6 trimmed. We will call "S".
        [                 - Initialise a list literal.
         13               - The literal 13.
           *17T           - The integer 170, composed by 17 * 10, so save whitespace.
               180        - The literal 180.
                      294 - The literal 294.
                  *30T    - The integer 300, composed by 30 * 10.
     gRQ                  - For each element, return 1 if is is ≥ the input. 0 otherwise.
    s                     - Sum.
@                         - Get the index into S of ^.
                          - Output implicitly.         

Mr. Xcoder

Posted 2017-09-09T13:53:59.333

Reputation: 39 774

1

Ly, 74 bytes

n(14)L["F"o;]p(171)L["E"o;]p(181)L["D"o;]p(195)L["C"o;]p(301)L["B"o;]"A"o;

Try it online!

A simple if-chain approach. I doubt it can be made much shorter.

LyricLy

Posted 2017-09-09T13:53:59.333

Reputation: 3 313

Are those paranthesis (...) required? P.S. nvm, Apparently they are. – officialaimm – 2017-09-10T08:34:49.877

1

Bash, 55 bytes

echo obase=16\;10 $[$1<{14,171,181,295,301}]|tr \  +|bc

Try it online or Verify test cases.

Justin Mariner

Posted 2017-09-09T13:53:59.333

Reputation: 4 746

1

Java 8, 55 bytes

n->n<14?'F':n<171?'E':n<181?'D':n<295?'C':n<301?'B':'A'

Try it here.

Alternative 57 bytes:

n->(char)(n<14?70:n<171?69:n<181?68:n<295?67:n<301?66:65)

Try it here.

Alternative 60 bytes:

n->"FEDCBA".charAt(n<14?0:n<171?1:n<181?2:n<295?3:n<301?4:5)

Try it here.

Maybe some kind of formula can be find to get 0-5 in a shorter way than n<14?0:n<171?1:n<181?2:n<295?3:n<301?4:5 using the last approach. Still investigating this.

Kevin Cruijssen

Posted 2017-09-09T13:53:59.333

Reputation: 67 575

1

Excel, 53 bytes

Sum of conditions, then returns the required ASCII character:

=CHAR((A1<14)+(A1<171)+(A1<181)+(A1<295)+(A1<301)+65)

Alternative solutions:

Summing conditions, return string index (63 bytes):

=MID("ABCDEF",(A1<14)+(A1<171)+(A1<181)+(A1<295)+(A1<301)+1,1)

Wernisch

Posted 2017-09-09T13:53:59.333

Reputation: 2 534

1

PowerShell, 59 bytes

(,'F'*14+,'E'*157+,'D'*10+,'C'*114+,'B'*6+,'A'*65)["$args"]

Try it online!

Similar-ish to Jonathan Allen's Jelly answer, in that we're constructing an array of all the letters concatenated together, then indexing into that array with the input $args.

AdmBorkBork

Posted 2017-09-09T13:53:59.333

Reputation: 41 581

1

Rabbit~, 50 bytes

(Noncompeting, postdates question. I just finished the interpreter(yay) and wanted to try and solve something. This is also my first code golf thing ever)

=>FEDCBA$<({.0-\_-^\-&^?n&&}_}\>\{{\>:.¤})Ð"ỤṅỌrḲA

It basically takes the differences from one grade to the next 14,157,10,114,6,65 (encoded as ỤṅỌrḲA) and subtracts from the input. If a negative number is found it stops progressing along the 'FEDCBA' sequence and outputs the letter.

Small explanation of this beautiful piece of syntax

Rabbit~ uses a grid based memory with one or several carets you can move around; this solution uses 2.

=>FEDCBA$<({.0-\_-^\-&^?n&&}_}\>\{{\>:.¤})Ð"ỤṅỌrḲA - Full program.

  FEDCBA                                           - Load bytes into grid
                                          Ð"ỤṅỌrḲA - Load bytes 14,157,10,114,6,65 into second line of data grid
=                                                  - Read input
 >       <      _ ^   ^     _  >   >               - Move caret (most instructions read from the grid below the active caret)
        $                                          - Create a new caret
          (                              )         - Loop
           {.0             } }   {{     }          - Conditional statement checking if value at caret == 0 then move active caret to next grade else print and quit
              -  -  -                              - Subtract 
               \   \          \ \                  - Cycle active caret
                     &   &&                        - Bitwise and to see if number is negative
                       ?n                          - Get negative sign bit
                                    :.             - Print value at caret as character
                                      ¤            - Terminate program

Adam

Posted 2017-09-09T13:53:59.333

Reputation: 131

Nice. Is there a way to try it online? – officialaimm – 2017-09-15T14:05:26.623

Not at the moment ^^ – Adam – 2017-09-15T14:14:26.993

1

Jotlin, 48 41 bytes

{v->'F'-l(13,170,180,294,300).f{a<v}.l()}

Whole program:

var x:(Int)->Char =
{v->'F'-l(13,170,180,294,300).f{a<v}.l()}

println(x(12))
println(x(15))
println(x(301))
println(x(181))

Ported my previous Kotlin answer here.

jrtapsell

Posted 2017-09-09T13:53:59.333

Reputation: 915

1

K (oK), 30 bytes

Solution:

"FEDCBA"@0 14 171 181 295 301'

Try it online!

Explanation:

Index into the correct bucket:

"FEDCBA"@0 14 171 181 295 301' / the solution
         0 14 171 181 295 301' / bin (') input in a bucket
"FEDCBA"@                      / index (@) into "FEDCBA"

streetster

Posted 2017-09-09T13:53:59.333

Reputation: 3 635

1

V, 37 34 bytes

aFEDCBA5äh113äh9äh156äh13ähÀ|vyVp

Try it online!

Hexdump:

00000000: 3133 4146 1b31 3536 4145 1b39 4144 1b31  13AF.156AE.9AD.1
00000010: 3133 4143 1b35 4142 1b36 3441 411b eec0  13AC.5AB.64AA...
00000020: 7c76 7956 70                             |vyVp

Basic idea:

  • Print FEDCBA, create 5 copies of B, 113 copies of C etc. resulting in the string FFFFFFFFFFFFFEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEDDDDDDDDDCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCBBBBBA (There is probably a more efficient way to do this)
  • Go to nth column (n is the first argument), copy a single character and replace the entire string with it.

oktupol

Posted 2017-09-09T13:53:59.333

Reputation: 697

1

05AB1E, 19 bytes

•5r¥[‚=€®•3ô›_ASsϤ

Try it online!

Magic Octopus Urn

Posted 2017-09-09T13:53:59.333

Reputation: 19 422

1

Perl 6, 42 39 bytes

{chr(65+[+] "\rª´ĦĬ".ords »>»$_)}

bb94

Posted 2017-09-09T13:53:59.333

Reputation: 1 831

1

Stax, 18 bytes

5"«µħĭ",+|oH-VA@]

Run and debug online!

Explanation

Bytes counted in CP437.

5"«µħĭ",+|oH-VA@]
5            -        5 minus the result of the following
 "«µħĭ"                   [14, 171, 181, 295, 301]
        ,+                Append input
          |oH             Index of last element if the array were to be sorted
              VA@]    Letter in the alphabet with the given index

Weijun Zhou

Posted 2017-09-09T13:53:59.333

Reputation: 3 396

0

C#, 110 bytes

x=>{if(x<14)return"F";if(x<171)return"E";if(x<181)return"D";if(x<295)return"C";if(x<301)return"B";return"A";};

Try it online

snorepion

Posted 2017-09-09T13:53:59.333

Reputation: 43

2You can shorten your lambda significantly using the trinary operator ?: as x<14?"F":x<170?"E":x<180?"D":x<294?"C":x<300?"B":"A" – Bradley Uffner – 2017-09-11T01:00:18.450