Created
March 5, 2012 07:32
-
-
Save Munera/1977260 to your computer and use it in GitHub Desktop.
EX4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
a) Write a program that gives the letter grade of each student in 350 | |
and whether the student passed or not | |
b) The program should also calculate the class average, min, and max grade | |
c) Improve the program to use functions | |
d) Try to distribute your functions across modules | |
""" | |
class_data = [ | |
{"name":"Mohammed Abdulla", "id":2008021080, "grade":91, }, | |
{"name":"Ali Ahmad", "id":2009011022, "grade":68, }, | |
{"name":"Ahmad Mohammad", "id":2008011085, "grade":74, }, | |
{"name":"Salem Sulaiman", "id":2007011033, "grade":97, }, | |
{"name":"Sara Fareed", "id":2008011003, "grade":85, }, | |
{"name":"Maha Khaled", "id":2006021087, "grade":93, }, | |
{"name":"Mneera Abdulla", "id":2008011019, "grade":60, }, | |
{"name":"Abdulaziz Ali", "id":2008021020, "grade":75, }, | |
{"name":"Sami Hamad", "id":2007011095, "grade":50, }, | |
{"name":"Maryam Ahmad", "id":2009011076, "grade":73, }, | |
{"name":"Mohammed Jasem", "id":2008021041, "grade":81, }, | |
] | |
for x in class_data: | |
print x["name"],x["id"],x["grade"], | |
if x["grade"] >= 90: | |
print "A, Pass" | |
elif x["grade"]>=80: | |
print "B, Pass" | |
elif x["grade"]>=70: | |
print "C, Pass" | |
elif x["grade"]>=60: | |
print "D, Pass" | |
else: | |
print "F, Not Pass" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment