Printing out the grades


#1

Alright so what i wrote seems to work. All the grades for each student show up in the grader (it may not look pretty and even though the answers get repeated 4 times it still works). But i keep getting an error saying that lloyd didnt print.
here is my code:

lloyd = {
    "name": "Lloyd",
    "homework": [90.0, 97.0, 75.0, 92.0],
    "quizzes": [88.0,40.0,94.0],
    "tests": [75.0,90.0]
}
alice = {
    "name": "Alice",
    "homework": [100.0, 92.0, 98.0, 100.0],
    "quizzes": [82.0, 83.0, 91.0],
    "tests": [89.0, 97.0]
}
tyler = {
    "name": "Tyler",
    "homework": [0.0, 87.0, 75.0, 22.0],
    "quizzes": [0.0, 75.0, 78.0],
    "tests": [100.0, 100.0]
}
students = [lloyd, alice, tyler]
for student in students:
    print lloyd
    print alice
    print tyler

#2

Be sure to check the instructions carefully. The for loop should make your life easier because you don't have to print each student independently. Instead, the for loop should let you just say, for each student in the group of students, print that student.

So, review the instructions and see how that might change your last three lines. Good luck!


#3

ok so this is what i tried next:

students = [lloyd, alice, tyler]
for student in students:
    print 'student name:%s' %student['name']
    print 'student homework:%s' %student['homework']
    print 'student quizzes:%s' %student['quizzes']
    print 'student tests:%s' %student['tests']

and it printed out nice and neat but i got the same error even though "lloyd" was included in the grader. You can clearly see
student name: Lloyd
followed by the rest of the keys with values. What am i missing?


#4

ok. i looked over the directions and the example. Decided to simplify my coding to only few commands.

students = [lloyd, alice, tyler]
for student in students:
print student["name"]
print student["homework"]
print student["quizzes"]
print student["tests"]

it worked!!!!!


#5

I got a problem with my code, I had some help but the else function won't work, everything else seems to work

import sys
def grader (x):

if 0.9 <= x <= 1.00: 
	print ("A") 
elif 0.80 <= x <= 0.89:  
	print ("B") 
elif 0.70 <= x <= 0.79:  
	print ("C") 
elif 0.60 <= x <= 0.69:  
	print ("D") 
elif 0. <= x <= 0.59:  
	print ("F") 
	
    else:
    	print("Number entered is invalid, please try again")

def main():

try: 
	score = float(input("Enter in score:")) 

except ValueError: 
	print ("Incorrect value") 
	main()

    else : 
		if score > 1.0:
        				print ("Input is too high, must be between 1.00 and 0.00")
					main()
    
		elif score < 0.0:
    				print ("Input is too low, must be between 1.00 and 0.00")
    main() 
else:
    grader(score)

	main()

`