I am trying to make a program that calculates grade point averages the user enters in a grade and then I compare the input to a dictionary. Here is my code I am sure what is wrong.
def average(g1):
dic = {"a": [4.],"A": [4.],"A-": [3.66],"a-": [3.66],"B+":[3.33], "b+": [3.33],"B": [3.],"b": [3.],"B-": [2.66], "b": [2.66],"C+": [2.33],"c+": [2.33],"C": [2.],"c": [2.], "D+": [1.66],"d+": [1.66],"D": [1.33],"d": [1.33],"D-": [1.], "d-": [1.],"F": [.66]}
for key in dic.keys():
if g1 in dic.keys:
print ("hello")
g1 = raw_input("Please enter grade 1: ")
average(g1)
Aucun commentaire:
Enregistrer un commentaire