## Grade book

Complete the function so that it finds the mean of the three scores passed to it and returns the letter value associated with that grade.

Numerical Score    | Letter Grade
---                | ---
90 <= score <= 100 | 'A'
80 <= score < 90   | 'B'
70 <= score < 80   | 'C'
60 <= score < 70   | 'D'
 0 <= score < 60   | 'F'

Tested values are all between 0 and 100. Theres is no need to check for negative values or values greater than 100.

Difficulty: EASY
Tags: Fundamentals

Starter code:
def get_grade(s1, s2, s3):
	

Solutions:
def get_grade(s1, s2, s3):
	m = (s1 + s2 + s3) / 3.0
	if 90 <= m <= 100:
		return 'A'
	elif 80 <= m < 90:
		return 'B'
	elif 70 <= m < 80:
		return 'C'
	elif 60 <= m < 70:
		return 'D'
	return 'F'


def get_grade(s1, s2, s3):
	mean = sum([s1, s2, s3]) / 3
	if mean >= 90:
		return 'A'
	if mean >= 80:
		return 'B'
	if mean >= 70:
		return 'C'
	if mean >= 60:
		return 'D'
	return 'F'


def get_grade(*s):
	return 'FFFFFFDCBAA'[sum(s) // 30]


scores = {10: 'A', 9: 'A', 8: 'B', 7: 'C', 6: 'D'}

def get_grade(*args):
	mean = sum(args) / len(args)
	return scores.get(mean // 10, 'F')


get_grade = lambda *a: 'FFFFFFDCBAA'[sum(a) // 3 // 10]


def get_grade(*arg):
	return list('FDCBAA')[max(int(sum(arg) / 30 - 5), 0)]


def get_grade(s1, s2, s3):
	m = (s1 + s2 + s3) / 3
	if m > 89:
		return 'A'
	elif m > 79:
		return 'B'
	elif m > 69:
		return 'C'
	elif m > 59:
		return 'D'
	else:
		return 'F'


def get_grade(*args):
	return {6: 'D', 7: 'C', 8: 'B', 9: 'A', 10: 'A'}.get(sum(args) // 30, 'F')


def get_grade(s1, s2, s3):
	return next(('ABCDF'[i] for (i, low) in enumerate([90, 80, 70, 60, 0]) if (s1 + s2 + s3) / 3 >= low))


def get_grade(*grades):
	mean = sum(grades) / len(grades)
	for (score, grade) in [(90, 'A'), (80, 'B'), (70, 'C'), (60, 'D'), (0, 'F')]:
		if mean >= score:
			return grade


def get_grade(s1, s2, s3):
	m = (s1 + s2 + s3) / 3
	return 'A' if m >= 90 else 'B' if m >= 80 else 'C' if m >= 70 else 'D' if m >= 60 else 'F'


def get_grade(s1, s2, s3):
	s = s1 + s2 + s3
	s /= 3
	if s >= 90:
		return 'A'
	elif s >= 80:
		return 'B'
	elif s >= 70:
		return 'C'
	elif s >= 60:
		return 'D'
	return 'F'


def get_grade(s1, s2, s3):
	grades = {range(60): 'F', range(60, 70): 'D', range(70, 80): 'C', range(80, 90): 'B', range(90, 101): 'A'}
	for x in grades:
		if int((s1 + s2 + s3) / 3) in x:
			return grades[x]


import math

def get_grade(a, b, c):
	mean = math.floor((a + b + c) / 3)
	print(mean)
	grades = {'A': [100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90], 'B': [98, 88, 87, 86, 85, 84, 83, 82, 81, 80], 'C': [79, 78, 77, 76, 75, 74, 73, 72, 71, 70], 'D': [69, 68, 67, 66, 65, 64, 63, 62, 61, 60]}
	for k in grades:
		if mean in grades[k]:
			return k
	return 'F'


from statistics import mean

def get_grade(s1, s2, s3):
	a = mean((s1, s2, s3))
	if a < 60:
		return 'F'
	elif a < 70:
		return 'D'
	elif a < 80:
		return 'C'
	elif a < 90:
		return 'B'
	else:
		return 'A'


def get_grade(*args):
	mean = sum(args) / len(args)
	if 90 <= mean <= 100:
		return 'A'
	elif 80 <= mean < 90:
		return 'B'
	elif 70 <= mean < 80:
		return 'C'
	elif 60 <= mean < 70:
		return 'D'
	else:
		return 'F'


def get_grade(*s):
	score = sum(s) / len(s)
	if 90 <= score <= 100:
		return 'A'
	elif 80 <= score < 90:
		return 'B'
	elif 70 <= score < 80:
		return 'C'
	elif 60 <= score < 70:
		return 'D'
	else:
		return 'F'


def get_grade(s1, s2, s3):
	mean = (s1 + s2 + s3) / 3.0
	if mean >= 70.0:
		if mean < 80.0:
			return 'C'
		elif mean < 90:
			return 'B'
		else:
			return 'A'
	elif mean >= 60:
		return 'D'
	else:
		return 'F'


def get_grade(s1, s2, s3):
	mean = (s1 + s2 + s3) / 3
	for (limit, grade) in [(90, 'A'), (80, 'B'), (70, 'C'), (60, 'D')]:
		if limit <= mean <= 100:
			return grade
	return 'F'


get_grade = lambda *scores: [letter for letter in {'A': (90, 100), 'B': (80, 90), 'C': (70, 80), 'D': (60, 70), 'F': (0, 60)} if {'A': (90, 100), 'B': (80, 90), 'C': (70, 80), 'D': (60, 70), 'F': (0, 60)}[letter][0] <= sum(scores) / len(scores) <= {'A': (90, 100), 'B': (80, 90), 'C': (70, 80), 'D': (60, 70), 'F': (0, 60)}[letter][1]][0]


def get_grade(s1, s2, s3):
	score = (s1 + s2 + s3) / 3
	grades = [[90, 'A'], [80, 'B'], [70, 'C'], [60, 'D'], [0, 'F']]
	for grade in grades:
		if score >= grade[0]:
			return grade[1]


import math

def get_grade(b, c, d):
	a = int((b + c + d) / 30)
	return 'A' if a == 10 else 'F' if a < 6 else chr(74 - a)


def get_grade(s1, s2, s3):
	score = (s1 + s2 + s3) / 3
	score_mapping = {90 <= score <= 100: 'A', 80 <= score < 90: 'B', 70 <= score < 80: 'C', 60 <= score < 70: 'D', 0 <= score < 60: 'F'}
	return score_mapping[True]


dict = {10: 'A', 9: 'A', 8: 'B', 7: 'C', 6: 'D'}

def get_grade(s1, s2, s3):
	mean = int((s1 + s2 + s3) / 30)
	if mean in dict:
		return dict[mean]
	return 'F'


def get_grade(s1, s2, s3):
	grade = ['F'] * 60 + ['D'] * 10 + ['C'] * 10 + ['B'] * 10 + ['A'] * 11
	scores = (s1 + s2 + s3) // 3
	return grade[scores]


def get_grade(*args):
	(avg, grades) = (sum(args) // len(args), ['F', 'D', 'C', 'B', 'A', 'A'])
	return grades[max(0, avg // 10 - 5)]


def get_grade(*arg):
	return list('FDCBAA')[max(int((sum(arg) / 3 - 50) / 10), 0)]


def get_grade(s1, s2, s3):
	if s1 + s2 + s3 >= 270:
		return 'A'
	if (s1 + s2 + s3 >= 240) & (s1 + s2 + s3 < 270):
		return 'B'
	if (s1 + s2 + s3 >= 210) & (s1 + s2 + s3 < 240):
		return 'C'
	if (s1 + s2 + s3 >= 180) & (s1 + s2 + s3 < 210):
		return 'D'
	if (s1 + s2 + s3 >= 0) & (s1 + s2 + s3 < 180):
		return 'F'
	return 'F'


mean = lambda nums: sum(nums) / (len(nums) + 0.0)

def get_grade(s1, s2, s3):
	m = mean([s1, s2, s3])
	if m >= 90:
		return 'A'
	elif m >= 80:
		return 'B'
	elif m >= 70:
		return 'C'
	elif m >= 60:
		return 'D'
	else:
		return 'F'


from collections import OrderedDict

def get_grade(*s):
	avg = sum(s) / len(s)
	for (a, g) in zip([60, 70, 80, 90], ['F', 'D', 'C', 'B']):
		if avg < a:
			return g
	return 'A'


def get_grade(s1, s2, s3):
	score = (s1 + s2 + s3) / 3
	if 90 <= score <= 100:
		return 'A'
	elif 80 <= score < 90:
		return 'B'
	elif 70 <= score < 80:
		return 'C'
	elif 60 <= score < 70:
		return 'D'
	else:
		return 'F'


def get_grade(*args):
	d = {(0, 6): 'F', (6, 7): 'D', (7, 8): 'C', (8, 9): 'B', (9, 11): 'A'}
	return next((d[rang] for rang in list(d.keys()) if sum(args) / len(args) // 10 in range(*rang)))


def get_grade(s1, s2, s3):
	s = s1 + s2 + s3
	res = s / 3
	if res >= 90 and res <= 100:
		return 'A'
	elif res >= 80 and res <= 90:
		return 'B'
	elif res >= 70 and res <= 80:
		return 'C'
	elif res >= 60 and res <= 70:
		return 'D'
	elif res >= 0 and res <= 60:
		return 'F'


def get_grade(s1, s2, s3):
	av = (int(s1) + int(s2) + int(s3)) / 3
	if int(av) >= 90:
		return 'A'
	if 80 <= int(av) < 90:
		return 'B'
	if 70 <= int(av) < 80:
		return 'C'
	if 60 <= int(av) < 70:
		return 'D'
	if int(av) < 60:
		return 'F'


def get_grade(s1, s2, s3):
	result = (s1 + s2 + s3) / 3
	if result >= 90:
		return 'A'
	elif result >= 80 and result < 90:
		return 'B'
	elif result >= 70 and result < 80:
		return 'C'
	elif result >= 60 and result < 70:
		return 'D'
	else:
		return 'F'


def get_grade(s1, s2, s3):
	score = (s1 + s2 + s3) / 3
	return {10: 'A', 9: 'A', 8: 'B', 7: 'C', 6: 'D'}.get(score // 10, 'F')


def get_grade(s1, s2, s3):
	mean_grade = (s1 + s2 + s3) / 3
	grade = ''
	if mean_grade >= 0 and mean_grade < 60:
		grade = 'F'
	if mean_grade >= 60 and mean_grade < 70:
		grade = 'D'
	if mean_grade >= 70 and mean_grade < 80:
		grade = 'C'
	if mean_grade >= 80 and mean_grade < 90:
		grade = 'B'
	if mean_grade >= 90 and mean_grade <= 100:
		grade = 'A'
	return grade


def get_grade(s1, s2, s3):
	score = (s1 + s2 + s3) / 3
	score = int(score)
	if score >= 90 and score <= 100:
		return 'A'
	if score >= 80 and score <= 90:
		return 'B'
	if score >= 70 and score <= 80:
		return 'C'
	if score >= 60 and score <= 70:
		return 'D'
	if score >= 0 and score <= 60:
		return 'F'


def get_grade(s1, s2, s3):
	letter_grades = {(90, 100): 'A', (80, 89): 'B', (70, 79): 'C', (60, 69): 'D', (0, 59): 'F'}
	grade = (s1 + s2 + s3) / 3
	for score in list(letter_grades.keys()):
		if score[0] <= grade <= score[1]:
			return letter_grades[score]


def get_grade(s1, s2, s3):
	avg = (s1 + s2 + s3) / 3
	scale = {'A': 90 <= avg <= 100, 'B': 80 <= avg < 90, 'C': 70 <= avg < 80, 'D': 60 <= avg < 70, 'F': 0 <= avg < 60}
	for (k, v) in scale.items():
		if v == True:
			return k


def get_grade(s1, s2, s3):
	result = sum((s1, s2, s3)) / 3
	if result > 90:
		return 'A'
	elif 90 > result >= 80:
		return 'B'
	elif 80 > result >= 70:
		return 'C'
	elif 70 > result >= 60:
		return 'D'
	elif 60 > result >= 0:
		return 'F'


def get_grade(s1, s2, s3):
	m = int((s1 + s2 + s3) / 3)
	if m >= 90 and m <= 100:
		return 'A'
	elif m >= 80 and m < 90:
		return 'B'
	elif m >= 70 and m < 80:
		return 'C'
	elif m >= 60 and m < 70:
		return 'D'
	else:
		return 'F'


def get_grade(s1, s2, s3):
	dic = {10: 'A', 9: 'A', 8: 'B', 7: 'C', 6: 'D', 5: 'F', 4: 'F', 3: 'F', 2: 'F', 1: 'F', 0: 'F'}
	return dic[(s1 + s2 + s3) / 3 // 10]


def get_grade(*args):
	mean = sum(args) // len(args)
	print(mean)
	grade = 'F'
	if mean in range(60, 70):
		grade = 'D'
	if mean in range(70, 80):
		grade = 'C'
	if mean in range(80, 90):
		grade = 'B'
	if mean in range(90, 101):
		grade = 'A'
	return grade


def get_grade(s1, s2, s3):
	avg = sum((s1, s2, s3)) // 3
	return ['F', 'D', 'C', 'B', 'A'][sum((avg > 59, avg > 69, avg > 79, avg > 89))]


def get_grade(s1, s2, s3):
	curr = sum([s1, s2, s3]) // 3
	m = [[90, 100, 'A'], [80, 90, 'B'], [70, 80, 'C'], [60, 70, 'D']]
	for (s, e, grade) in m:
		if s <= curr <= e:
			return grade
	return 'F'


def get_grade(s1, s2, s3):
	result = sum([s1, s2, s3]) // 30
	if result >= 9:
		return 'A'
	elif result >= 8:
		return 'B'
	elif result >= 7:
		return 'C'
	elif result >= 6:
		return 'D'
	else:
		return 'F'


def get_grade(s1, s2, s3):
	print((s1, s2, s3))
	x = (s1 + s2 + s3) / 3
	if x <= 100 and x >= 90:
		return 'A'
	elif x <= 89 and x >= 80:
		return 'B'
	elif x <= 79 and x >= 70:
		return 'C'
	elif x <= 69 and x >= 60:
		return 'D'
	else:
		return 'F'


def get_grade(*args):
	if sum(args) / len(args) >= 90:
		return 'A'
	if sum(args) / len(args) >= 80:
		return 'B'
	if sum(args) / len(args) >= 70:
		return 'C'
	if sum(args) / len(args) >= 60:
		return 'D'
	return 'F'


import numpy as np

def get_grade(*scores):
	grades = {10: 'A', 9: 'A', 8: 'B', 7: 'C', 6: 'D'}
	return grades.get(np.mean(scores) // 10, 'F')


def get_grade(s1, s2, s3):
	f = int((s1 + s2 + s3) / 3)
	if f in range(90, 101):
		return 'A'
	elif f in range(80, 90):
		return 'B'
	elif f in range(70, 80):
		return 'C'
	elif f in range(60, 70):
		return 'D'
	elif f in range(0, 60):
		return 'F'


def get_grade(s1, s2, s3):
	score = s1 + s2 + s3
	if 270 <= score:
		return 'A'
	elif 240 <= score:
		return 'B'
	elif 210 <= score:
		return 'C'
	elif 180 <= score:
		return 'D'
	return 'F'


def get_grade(s1, s2, s3):
	grades = (s1, s2, s3)
	total = sum(grades)
	mean = total / len(grades)
	if 100 >= mean >= 90:
		return 'A'
	elif 90 > mean >= 80:
		return 'B'
	elif 80 > mean >= 70:
		return 'C'
	elif 70 > mean >= 60:
		return 'D'
	else:
		return 'F'