To check if a student has a honor's degree (Using Class in python)

 class student:


def __init__(self, name, gpa, study_field):
self.name=name
self.gpa=gpa
self.study_field=study_field

def on_honor_call(self):
if self.gpa>=3.5:
return True
else:
return False
then create new file in pycharm 
from next import student

student1=student("Komal", 4.2, "Science")
student2=student("Mike", 3.2, "Arts")

print(student2.on_honor_call())

Comments

Popular posts from this blog

Multiple linear regression for GW depth estimaition

Class in Python