Last active
May 10, 2022 20:07
-
-
Save wulab/476f1e0957e4ebf8a90a87af8e11567e to your computer and use it in GitHub Desktop.
Student grading without if/else or for loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grade <- function(score) { | |
levels <- c("F", "D", "C", "B", "A") | |
return( levels[(score>80)+(score>60)+(score>40)+(score>20)+(score>0)] ) | |
} |
Author
wulab
commented
May 10, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment