top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

Classes in python

Writer's picture: Wilson WahaWilson Waha

A mold is an object that always produces elements of the same shape. In the same way a class is a container which allows to create elements of the same form called objects. As we can create a cake from a mold, we can also create objects (class instances) from a class. A class can have properties that describe it and method that give it behavior.




class student_info:
    """
    This class contains necessary informations about a student
    """
    
    student_id = ""
    firstname = ""
    lastname = ""
    grade = ""
    school = ""
    faculty =""
    
    # constructor
    def __init__(self,s_id,fn,ln,grade, sh, fa):
        
        self.student_id = s_id
        self.firstname = fn
        self.lastname = ln
        self.grade = grade
        self.school = sh
        self.faculty = fa
        
        
    # methods to access informations about a student (getters)
        
    def get_student_id(self):
        return self.student_id
    
    def get_firstname(self):
        return self.firstname
    
    def get_lastname(self):
        return self.lastname

    
    def get_grade(self):
        return self.grade
    
    def get_school(self):
        return self.school
    
    def get_faculty(self):
        return self.faculty
    
    # Method to modify student information (setter)
    
    def set_student_id(self,st_id):
        self.student_id = st_id
        
    def set_firstname(self,firstN):
        self.firstname = firstN
        
    def set_lastname(self,lastN):
        self.lastname = lastN
        
        
    def set_grade(self,grad):
        self.grade = grad
        
    def set_school(self,sch):
        self.school = sch
        
    def set_faculty(self,fac):
        self.faculty = fac

Illustration: we create two instances of class student

in: stud1 = student_info("DI2122S82","Adama", "wilson", 5, "dataInsight","computer science")
stud2 = student_info("DI2122S04", "Traore", "Lucas", 2, "DataInsight", "Mathematics")

we get some information about stud1


in: stud1.get_student_id(), stud.get_school(), stud.get_faculty(), stud.get_firstname(), stud.get_lastname()
out: ('DI2122S82', 'dataInsight', 'computer science', 'Adama', 'wilson')

We modify the id of stud1

in: stud1.set_student_id("DI212265")

Access to the new id of stud1

in: stud1.get_student_id()
out: 'DI212265'

0 comments

Recent Posts

See All

Commentaires


COURSES, PROGRAMS & CERTIFICATIONS

 

Advanced Business Analytics Specialization

Applied Data Science with Python (University of Michigan)

Data Analyst Professional Certificate (IBM)

Data Science Professional Certificate (IBM)

Data Science Specialization (John Hopkins University)

Data Science with Python Certification Training 

Data Scientist Career Path

Data Scientist Nano Degree Program

Data Scientist Program

Deep Learning Specialization

Machine Learning Course (Andrew Ng @ Stanford)

Machine Learning, Data Science and Deep Learning

Machine Learning Specialization (University of Washington)

Master Python for Data Science

Mathematics for Machine Learning (Imperial College London)

Programming with Python

Python for Everybody Specialization (University of Michigan)

Python Machine Learning Certification Training

Reinforcement Learning Specialization (University of Alberta)

Join our mailing list

Data Insight participates in affiliate programs and may sometimes get a commission through purchases made through our links without any additional cost to our visitors.

bottom of page