-
-
Save IndhumathyChelliah/dc2f8684c35de80377363ab618b9d677 to your computer and use it in GitHub Desktop.
This file contains 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
#importing logger file(log.py) | |
from log import getLog | |
#Setting name to logger | |
logger =getLog('student.py') | |
class Student: | |
def __init__(self,firstname,lastname,rollno): | |
self.firstname=firstname | |
self.lastname=lastname | |
self.rollno=rollno | |
#logging info - Student Creation | |
logger.info("Created Student {}-{}".format(self.firstname,self.lastname)) | |
def Totalmarks(self,*args): | |
try: | |
totalmarks=sum(args) | |
#logging totalmarks | |
logger.info("Totalmarks:"+str(totalmarks)) | |
return totalmarks | |
except Exception as e: | |
logger.error(e) | |
raise | |
def grade(self,totalmarks): | |
logger.info("Inside Grade :"+str(totalmarks)) | |
if totalmarks>=400: | |
return "Grade A" | |
elif totalmarks>=300: | |
return "Grade B" | |
else: | |
return "Grade C" | |
s1=Student("indhu","mathy",12) | |
s=s1.Totalmarks(100,90,100) | |
print (s) | |
print (s1.grade(s)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment