Class in Python
class student:
def __init__(self, name, rollno, gpa, is_a_boy):
self.name=name
self.rollno=rollno
self.gpa=gpa
self.is_a_boy=is_a_boy
Then create new file in pycharm, then type this code
from next import student
student1=student("jim",24,3.2,True)
student2=student("Pam",25,2.2,False)
print(student1.gpa)
Comments
Post a Comment