#!/usr/bin/env python # -*- coding: utf8 -*- # Your very first Python example program # (these lines are comments, ie. will not be executed) print "We want to compute the average mark for one student for the semester." # This is the marks of one student marks = { "MA101": 66.0, "PH101": 49.0, "ME101": 63.0, "SE101": 87.0, # Excellent ! "EE101": 31.0, "HS101": 69.0, "HS102": 24.0, # Huge arning ! } # The number of course number_course = len(marks) # The average of that student average = sum(marks.values()) / number_course assert(0 <= average <= 100) # We print the average mark print "Your average mark is {average:2.2f}%.".format(average=average) # We congratulate you according to your average if average < 30: print "Keep working, you can do better!" elif 30 <= average < 60: print "That's OK, but you can improve!" elif 60 <= average < 80: print "Well done! Do better on the next sem'!" else: print "Excellent!!"