Question: PYTHON QUESTION: Loop though all the students and call your previous function print_Grade. #GIVEN INFO: Names = {0:'Vivan', 1:'Cassaundra', 2:'Kayla', 3:'Dany', 4:'Kaley', 5:'Teodoro', 6:'Corrin', 7:'Monique',
PYTHON QUESTION: Loop though all the students and call your previous function print_Grade.
#GIVEN INFO:
Names = {0:'Vivan', 1:'Cassaundra', 2:'Kayla', 3:'Dany', 4:'Kaley', 5:'Teodoro', 6:'Corrin', 7:'Monique', 8:'Dwayne', 9:'Louetta'} Grades = {} for i in range(10): Grades[i]=random.randint(0,100)
#MY CODE BELOW:
for Names,Grades in print_Grade(Names, Grades): D2={Names[0]:Grades[0], #ECT} print(D2)
#ERROR CODE:
TypeError: '>' not supported between instances of 'dict' and 'int'
#ADDITIONAL INFO: Previous to this code, there was a question that: def print_Grade(Names,Grades) and used if, elif, and else functions with > and < operators.
**Lastly, populate a third dictionary with the Names as keys and Grades as values. Use loops.
**Why/how would we use loops if we could initialize like: D2={Names[0]:Grades[0], #ECT}? What's the difference with the question above?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
