Tuesday, May 21, 2013

Learning Python(Pt II)


lloyd = {
    "name": "Lloyd",
    "homework": [90, 97, 75, 92],
    "quizzes": [88, 40, 94],
    "tests": [75, 90]
}
alice = {
    "name": "Alice",
    "homework": [100, 92, 98, 100],
    "quizzes": [82, 83, 91],
    "tests": [89, 97]
}
tyler = {
    "name": "Tyler",
    "homework": [0, 87, 75, 22],
    "quizzes": [0, 75, 78],
    "tests": [100, 100]
}

students = [lloyd, alice, tyler]

def average(x):
    return sum(x) / len(x)
def get_average(x):
    return (average(x["homework"]) * 0.1 +
    average(x["quizzes"]) * 0.3 +
    average(x["tests"]) * 0.6)

def get_letter_grade(score):
    score = round(score)
    
    if score >= 90:
        return "A"
    elif 80 <= score < 90:
        return "B"
    elif 70 <= score < 80:
        return "C"
    elif 60 <= score < 70:
        return "D"
    elif score < 60:
        return "F"
    
print get_letter_grade(get_average(lloyd))

def get_class_average(students):
    n = 0
    for each in students:
        n+=get_average(each)
    return n/len(students)
    
print get_class_average(students)

Here is some of the code I've been doing on codecademy. Basically this code consists of 3 dictionaries containing students grades, then there are 4 functions that do different things such as: finding the average grade for a student, finding the weighted average for the student, then finding the letter grade, then finding the overall letter grade. Python is actually not that difficult compared to javascript.

Wednesday, May 15, 2013

Learning Python(I guess)

Completed the first little tutorial on codecademy on python. Pretty fun and easy, similar to javascript so far except for the fact that whitespace is important in python.

Thursday, May 2, 2013

GUI :D

I have been making all the GUI in the game recently and it's been awesome. A nice break from coding all the time. Here are just a few examples of the different stages of the back button, but all of the buttons have similar stages. I've also been making the signage for the game, which is the last picture. We didn't want to use any words on the signs so we used pictures instead.