Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
612 B
6
Indexable
Never
def analyze_grade():
    grades = []

    while True:
        user = input("Input: ")

        if user.lower() == "quit":
            break

        try:
            grades.append(int(user))

        except ValueError:
            print("No interger given")
            return None

    mean = sum(grades)/len(grades)

    variance = 0
    for value in grades:
        variance += (value - mean)**2

    sd = (variance/len(grades))**0.5

    print("Minimum: {}\nMaximum: {}\nAverage: {}\nSD: {}".format(min(grades), max(grades), mean, sd))


def main():
    analyze_grade()

if __name__ == '__main__':
    main()
Leave a Comment