Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created June 17, 2020 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/dc2f8684c35de80377363ab618b9d677 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/dc2f8684c35de80377363ab618b9d677 to your computer and use it in GitHub Desktop.
#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