You're a statistics professor and the deadline for submitting your students' grades is tonight at midnight. Each student's grade is determined by their mean score across all of the tests they took this semester.

You've decided to automate grade calculation by writing a function `calculate_grade()` that takes a list of test scores as an argument and returns a one character string representing the student's grade calculated as follows:

 * 90% <= mean score <= 100%: `"A"`,
 * 80% <= mean score < 90%: `"B"`,
 * 70% <= mean score < 80%: `"C"`,
 * 60% <= mean score < 70%: `"D"`,
 * mean score < 60%: `"F"`

For example, `calculate_grade([92, 94, 99])` would return `"A"` since the mean score is `95`, and `calculate_grade([50, 60, 70, 80, 90])` would return `"C"` since the mean score is `70`.

Your function should handle an input list of any length greater than zero.

Difficulty: introductory

Starter code:

def calculate_grade(scores):
	

Solutions:
from bisect import bisect
from statistics import mean


def calculate_grade(scores):
    return 'FDCBA'[bisect([60, 70, 80, 90], mean(scores))]


def calculate_grade(scores):
    for score in scores:
        mean = sum(scores)/len(scores)
        if mean >= 90 and mean <= 100:
            return "A"
        elif mean >= 80 and mean < 90:
            return "B"
        elif mean >= 70 and mean < 80:
            return "C"
        elif mean >= 60 and mean < 70:
            return "D"
        else:
            return "F"

import statistics

def calculate_grade(scores):
    mean = statistics.mean(scores)
    if mean >= 90: return "A"
    if mean >= 80: return "B"
    if mean >= 70: return "C"
    if mean >= 60: return "D"
    return "F"

def calculate_grade(scores):
    s = sum(scores) / len(scores)
    return 'ABCDF'[(s < 90) + (s < 80) + (s < 70) + (s < 60)]

from statistics import mean


def calculate_grade(scores):
    a = mean(scores)
    return (
        'A' if a >= 90 else
        'B' if a >= 80 else
        'C' if a >= 70 else
        'D' if a >= 60 else
        'F'
    )

def calculate_grade(scores):
    import numpy as np
    mean_score = np.mean(scores)
    if mean_score >= 90:
        return "A"
    elif mean_score >= 80:
        return "B"
    elif mean_score >= 70:
        return "C"
    elif mean_score >= 60:
        return "D"
    else:
        return "F"


def calculate_grade(scores):
    mean = sum(scores) / len(scores)
    return "ABCDF"[(mean < 90) + (mean < 80) + (mean < 70) + (mean < 60)]

def calculate_grade(scores):
    score = (sum(scores)/len(scores))/100
    grades = { 0.6:"D",0.7:"C",0.8:"B",0.9:"A"}
    return grades[round(score,1)] if score > 0.6 else "F"


def calculate_grade(scores):

    avg_grade = sum(scores)/len(scores)
    if avg_grade < 60:
        return "F"
    elif avg_grade < 70:
        return "D"
    elif avg_grade < 80:
        return "C"
    elif avg_grade < 90:
        return "B"
    else:
        return "A"

def calculate_grade(scores):
    x = sum(scores)/len(scores)
    return 'A' if x >= 90 else 'B' if x >= 80 else 'C' if x >= 70 else 'D' if x >= 60 else 'F'